Class: ZooMQ::Client::Connection

Inherits:
ZMachine::Connection
  • Object
show all
Defined in:
lib/zoomq/client/connection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#clientObject

Returns the value of attribute client.



5
6
7
# File 'lib/zoomq/client/connection.rb', line 5

def client
  @client
end

Instance Method Details

#receive_data(msg) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/zoomq/client/connection.rb', line 7

def receive_data(msg)
  msg.unwrap # strip origin
  # TODO: unwrap data to string from bytes to_i wtf
  request_id = String.from_java_bytes(msg.unwrap.data).to_i
  cls = String.from_java_bytes(msg.pop.data).constantize
  obj = cls.parse(String.from_java_bytes(msg.pop.data))
  @client.response(request_id, obj)
end