Class: EZMQ::Publisher
Overview
Publish socket that broadcasts messages with an optional topic.
Instance Attribute Summary
Attributes inherited from Socket
#context, #decode, #encode, #socket
Instance Method Summary (collapse)
-
- (Publisher) initialize(**options)
constructor
Creates a new Publisher socket.
-
- (Fixnum) send(message = '', topic: '', **options)
Sends a message on the socket, with an optional topic.
Methods inherited from Socket
#bind, #connect, #listen, #receive
Constructor Details
- (Publisher) initialize(**options)
Creates a new Publisher socket.
14 15 16 |
# File 'lib/ezmq/publish.rb', line 14 def initialize(**) super :bind, ZMQ::PUB, end |
Instance Method Details
- (Fixnum) send(message = '', topic: '', **options)
Sends a message on the socket, with an optional topic.
27 28 29 |
# File 'lib/ezmq/publish.rb', line 27 def send( = '', topic: '', **) @socket.send_string "#{ topic } #{ ([:encode] || @encode).call }" end |