Class: DDP::Server::Rack

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

Overview

Rack middleware for running DDP

Constant Summary

Constants included from Protocol

Protocol::DDP_VERSION

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, #result, #updated

Methods included from Protocol::Data

#added, #added_before, #changed, #handle_data, #handle_sub, #handle_unsub, #moved_before, #nosub, #ready, #removed

Methods included from Protocol::Heartbeat

#handle_heartbeat

Instance Method Details

#on_openObject



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

def on_open
	handle_connect
end

#read_messageObject



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

def read_message
	JSON.parse read
end

#write_message(message) ⇒ Object



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

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