Class: Startback::Websocket::Hub::Middleware::CommandHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/startback/websocket/hub/middleware/command_handler.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, opts, &bl) ⇒ CommandHandler

Returns a new instance of CommandHandler.



8
9
10
11
12
# File 'lib/startback/websocket/hub/middleware/command_handler.rb', line 8

def initialize(app, opts, &bl)
  @app = app
  @opts = opts
  @handler = bl
end

Instance Method Details

#call(event, socket, env) ⇒ Object



14
15
16
17
# File 'lib/startback/websocket/hub/middleware/command_handler.rb', line 14

def call(event, socket, env)
  who = matches?(event) ? @handler : @app
  who.call(event, socket, env)
end