Module: DripDrop::ZMQReadableHandler
- Included in:
- Mongrel2Handler, ZMQPullHandler, ZMQSubHandler, ZMQXRepHandler, ZMQXReqHandler
- Defined in:
- lib/dripdrop/handlers/zeromq.rb
Instance Attribute Summary collapse
-
#message_class ⇒ Object
Returns the value of attribute message_class.
Instance Method Summary collapse
Instance Attribute Details
#message_class ⇒ Object
Returns the value of attribute message_class.
94 95 96 |
# File 'lib/dripdrop/handlers/zeromq.rb', line 94 def @message_class end |
Instance Method Details
#decode_message(msg) ⇒ Object
96 97 98 |
# File 'lib/dripdrop/handlers/zeromq.rb', line 96 def (msg) @message_class.decode(msg) end |
#on_readable(socket, messages) ⇒ Object
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/dripdrop/handlers/zeromq.rb', line 100 def on_readable(socket, ) begin case @msg_format when :raw @recv_cbak.call() when :dripdrop if .length > 1 raise "Expected message in one part for #{self.inspect}, got #{.map(&:copy_out_string)}" end body = .shift.copy_out_string @recv_cbak.call((body)) else raise "Unknown message format '#{@msg_format}'" end rescue StandardError => e handle_error(e) end end |