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(mode = :bind, **options)
constructor
Creates a new Server socket.
-
- (void) listen {|message| ... }
Listens for a request, and responds to it.
Methods inherited from Socket
Constructor Details
- (Server) initialize(mode = :bind, **options)
Creates a new Server socket.
15 16 17 |
# File 'lib/ezmq/reply.rb', line 15 def initialize(mode = :bind, **) super mode, 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.
29 30 31 32 33 34 35 36 37 |
# File 'lib/ezmq/reply.rb', line 29 def listen loop do if block_given? send yield receive else send receive end end end |