Module: Scales::Server::Dispatch::Response

Defined in:
lib/scales-server/dispatch/response.rb

Constant Summary collapse

@@redis =
nil
@@subscribers =
{}
@@subscribed =
false

Class Method Summary collapse

Class Method Details

.reset!Object



17
18
19
20
21
# File 'lib/scales-server/dispatch/response.rb', line 17

def reset!
  @@redis       = nil
  @@subscribers = {}
  @@subscribed  = false
end

.subscribe(id) ⇒ Object



11
12
13
14
15
# File 'lib/scales-server/dispatch/response.rb', line 11

def subscribe(id)
  setup_subscription!
  @@subscribers[id] = Fiber.current
  Fiber.yield
end