class CZTop::Socket::ROUTER

Router socket for the ZeroMQ Request-Reply Pattern. @see rfc.zeromq.org/spec:28

Public Class Methods

new(endpoints = nil) click to toggle source

@param endpoints [String] endpoints to bind to

# File lib/cztop/socket/types.rb, line 101
def initialize(endpoints = nil)
  attach_ffi_delegate(Zsock.new_router(endpoints))
end

Public Instance Methods

send_to(receiver, message) click to toggle source

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. @param receiver [String] receiving peer's socket identity @param message [Message] the message to send @note Do NOT use the message afterwards. It'll have been modified and

destroyed.
# File lib/cztop/socket/types.rb, line 111
def send_to(receiver, message)
  message = Message.coerce(message)
  message.prepend ""       # separator frame
  message.prepend receiver # receiver envelope
  self << message
end