Class: Tinker::WebSocket

Inherits:
Object
  • Object
show all
Defined in:
lib/tinker/websocket.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(websocket) ⇒ WebSocket

Returns a new instance of WebSocket.



4
5
6
# File 'lib/tinker/websocket.rb', line 4

def initialize(websocket)
  @socket = websocket
end

Instance Attribute Details

#socketObject (readonly)

Returns the value of attribute socket.



2
3
4
# File 'lib/tinker/websocket.rb', line 2

def socket
  @socket
end

Instance Method Details

#send(params) ⇒ Object



8
9
10
11
# File 'lib/tinker/websocket.rb', line 8

def send(params)
  message = params.to_json
  Tinker.application.message_queue << Tinker::Network::Message.new(:body => message, :socket => socket)
end