Exception: Skyfall::ReactorActiveError

Inherits:
Error
  • Object
show all
Defined in:
lib/skyfall/errors.rb

Overview

Raised when Stream#connect is called and there’s already another instance of Stream or its subclass like Firehose that’s connected to another websocket.

This is currently not supported in Skyfall, because it uses EventMachine behind the scenes, which runs everything on a single “reactor” thread, and there can be only one such reactor thread in a given process. In theory, it should be possible for two connections to run inside a single shared EventMachine event loop, but it would require some more coordination and it might have unexpected side effects - e.g. synchronous work (including I/O and network requests) done during processing of an event from one connection would be blocking the other connection.

Instance Method Summary collapse

Constructor Details

#initializeReactorActiveError

Returns a new instance of ReactorActiveError.



34
35
36
37
38
39
# File 'lib/skyfall/errors.rb', line 34

def initialize
  super(
    "An EventMachine reactor thread is already running, but it seems to have been launched by another Stream. " +
    "Skyfall doesn't currently support running two different Stream instances in a single process."
  )
end