Module: SimpleRPC::SocketProtocol::Stream

Defined in:
lib/simplerpc/socket_protocol.rb

Overview

Send objects by streaming them through a socket using a serialiser such as Marshal.

Fast and with low memory requirements, but is inherently unsafe (arbitrary code execution) and doesn’t work with some serialisers.

SimpleRPC uses this library for calls, and uses SocketProtocol::Simple for auth challenges (since it is safer)

Class Method Summary collapse

Class Method Details

.recv(s, serialiser) ⇒ Object

Recieve using a serialiser reading from the socket



46
47
48
# File 'lib/simplerpc/socket_protocol.rb', line 46

def self.recv(s, serialiser)
  return serialiser.load(s)
end

.send(s, obj, serialiser) ⇒ Object

Send using a serialiser writing through the socket



41
42
43
# File 'lib/simplerpc/socket_protocol.rb', line 41

def self.send(s, obj, serialiser)
  return serialiser.dump(obj, s)
end