Class: DDP::Server::WebSocket

Inherits:
Celluloid::WebSocket
  • Object
show all
Includes:
Protocol
Defined in:
lib/ddp/server.rb

Overview

Server on top of a Celluloid::WebSocket

Constant Summary

Constants included from Protocol

Protocol::DDP_VERSION

Constants included from Protocol::RPC

Protocol::RPC::NO_RESULT

Instance Attribute Summary

Attributes included from Protocol

#session_id

Instance Method Summary collapse

Methods included from Protocol

#handle_connect, #handle_established, #handle_session, #new_session_id

Methods included from Protocol::RPC

#handle_method, #handle_rpc, #send_error_result, #send_result, #send_updated

Methods included from Protocol::Data

#handle_data, #handle_sub, #handle_unsub, #send_added, #send_added_before, #send_changed, #send_moved_before, #send_nosub, #send_ready, #send_removed

Methods included from Protocol::Heartbeat

#handle_heartbeat

Instance Method Details

#on_openObject



13
14
15
# File 'lib/ddp/server.rb', line 13

def on_open
  handle_connect
end

#read_messageObject



17
18
19
# File 'lib/ddp/server.rb', line 17

def read_message
  JSON.parse read
end

#write_message(message) ⇒ Object



21
22
23
# File 'lib/ddp/server.rb', line 21

def write_message(message)
  write JSON.generate(message)
end