Class: CZTop::Socket::ROUTER
- Inherits:
-
CZTop::Socket
- Object
- CZTop::Socket
- CZTop::Socket::ROUTER
- Defined in:
- lib/cztop/socket/types.rb
Overview
Router socket for the ZeroMQ Request-Reply Pattern.
Constant Summary
Constants inherited from CZTop::Socket
Constants included from CZTop::SendReceiveMethods
CZTop::SendReceiveMethods::FD_TIMEOUT, CZTop::SendReceiveMethods::JIFFY
Instance Attribute Summary
Attributes inherited from CZTop::Socket
Attributes included from HasFFIDelegate
Instance Method Summary collapse
-
#initialize(endpoints = nil) ⇒ ROUTER
constructor
A new instance of ROUTER.
-
#send_to(receiver, message) ⇒ Object
Send a message to a specific receiver.
Methods inherited from CZTop::Socket
#CURVE_client!, #CURVE_server!, #bind, #close, #connect, #disconnect, #inspect, #last_endpoint, new_by_type, #unbind
Methods included from HasFFIDelegate::ClassMethods
#ffi_delegate, #from_ffi_delegate
Methods included from PolymorphicZsockMethods
#set_unbounded, #signal, #wait
Methods included from CZTop::SendReceiveMethods
#<<, #read_timeout, #receive, #wait_for_fd_signal, #wait_writable, #write_timeout
Methods included from ZsockOptions
#fd, #options, #readable?, #to_io, #writable?
Methods included from HasFFIDelegate
#attach_ffi_delegate, #from_ffi_delegate, raise_zmq_err, #to_ptr
Constructor Details
#initialize(endpoints = nil) ⇒ ROUTER
Returns a new instance of ROUTER.
142 143 144 145 146 |
# File 'lib/cztop/socket/types.rb', line 142 def initialize(endpoints = nil) super attach_ffi_delegate(Zsock.new_router(endpoints)) end |
Instance Method Details
#send_to(receiver, message) ⇒ Object
Do NOT use the message afterwards. It’ll have been modified and destroyed.
Send a message to a specific receiver. This is a shorthand for when you send a message to a specific receiver with no hops in between.
155 156 157 158 159 160 |
# File 'lib/cztop/socket/types.rb', line 155 def send_to(receiver, ) = Message.coerce() .prepend '' # separator frame .prepend receiver # receiver envelope self << end |