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(mode = :bind, **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
Constructor Details
- (Publisher) initialize(mode = :bind, **options)
Creates a new Publisher socket.
15 16 17 |
# File 'lib/ezmq/publish.rb', line 15 def initialize(mode = :bind, **) super mode, ZMQ::PUB, end |
Instance Method Details
- (Fixnum) send(message = '', topic: '', **options)
Sends a message on the socket, with an optional topic.
28 29 30 31 |
# File 'lib/ezmq/publish.rb', line 28 def send( = '', topic: '', **) = "#{ topic } #{ ([:encode] || @encode).call }" @socket.send_string end |