Module: Rum::Remote::Connection::Messaging
- Defined in:
- lib/rum/remote.rb
Instance Method Summary collapse
-
#dispatch(msg) ⇒ Object
Assumes message is not larger than 4,3 GB ((2**(4*8) - 1) bytes).
- #receive ⇒ Object
Instance Method Details
#dispatch(msg) ⇒ Object
Assumes message is not larger than 4,3 GB ((2**(4*8) - 1) bytes)
29 30 31 32 33 |
# File 'lib/rum/remote.rb', line 29 def dispatch(msg) msg.encode! Encoding::UTF_8 msg.force_encoding Encoding::BINARY write([msg.length].pack('N') + msg) end |
#receive ⇒ Object
35 36 37 38 39 40 |
# File 'lib/rum/remote.rb', line 35 def receive if = read(4) # sizeof (N) = .unpack('N')[0] read().force_encoding(Encoding::UTF_8) end end |