Class: EZMQ::Server
Overview
Reply socket that listens for and replies to requests.
Instance Attribute Summary
Attributes inherited from Socket
#context, #decode, #encode, #socket
Instance Method Summary (collapse)
-
- (Server) initialize(**options)
constructor
Creates a new Server socket.
-
- (void) listen {|message| ... }
Listens for a request, and responds to it.
Methods inherited from Socket
#bind, #connect, #receive, #send
Constructor Details
- (Server) initialize(**options)
Creates a new Server socket.
166 167 168 |
# File 'lib/ezmq.rb', line 166 def initialize(**) super :bind, ZMQ::REP, end |
Instance Method Details
- (void) listen {|message| ... }
This method returns an undefined value.
Listens for a request, and responds to it.
If no block is given, responds with the request message.
180 181 182 183 184 185 186 187 188 |
# File 'lib/ezmq.rb', line 180 def listen loop do if block_given? send yield receive else send receive end end end |