Class: SocketableController

Inherits:
WebsocketRails::BaseController
  • Object
show all
Defined in:
app/controllers/socketable_controller.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#paramsObject

Returns the value of attribute params.



2
3
4
# File 'app/controllers/socketable_controller.rb', line 2

def params
  @params
end

Instance Method Details

#broadcast(data, to_event) ⇒ Object



18
19
20
# File 'app/controllers/socketable_controller.rb', line 18

def broadcast(data, to_event)
  broadcast_message(to_event, data)
end

#emit(data, to_event) ⇒ Object



14
15
16
# File 'app/controllers/socketable_controller.rb', line 14

def emit(data, to_event)
  send_message(to_event, data)
end

#requestObject

Handle all requests



5
6
7
8
9
10
11
12
# File 'app/controllers/socketable_controller.rb', line 5

def request
  begin
    @params = formated_params
    controller.new.websocket(params, self)
	rescue Exception => e
    error_message e
	end
end