Class: EventMachine::XS::Sockets::Subscriber
- Inherits:
-
EventMachine::XS::Socket
- Object
- Connection
- EventMachine::XS::Socket
- EventMachine::XS::Sockets::Subscriber
- Defined in:
- lib/em-xs/patterns/pub_sub_pattern.rb
Constant Summary
Constants inherited from EventMachine::XS::Socket
EventMachine::XS::Socket::TYPES_MAPPING
Instance Attribute Summary
Attributes inherited from EventMachine::XS::Socket
#handler, #on_readable, #on_writable, #socket, #socket_type
Instance Method Summary collapse
Methods inherited from EventMachine::XS::Socket
#bind, #connect, get_class_for_type, #getsockopt, #initialize, map_sockopt, #notify_readable, #notify_writable, #readable?, #register_readable, #register_writable, #send_msg, #setsockopt, #unbind, #writable?
Constructor Details
This class inherits a constructor from EventMachine::XS::Socket
Instance Method Details
#subscribe(what = '') ⇒ Object
11 12 13 14 |
# File 'lib/em-xs/patterns/pub_sub_pattern.rb', line 11 def subscribe(what = '') raise "only valid on sub socket type (was #{@socket.name})" unless @socket.name == 'SUB' @socket.setsockopt(::XS::SUBSCRIBE, what) end |
#unsubscribe(what) ⇒ Object
16 17 18 19 |
# File 'lib/em-xs/patterns/pub_sub_pattern.rb', line 16 def unsubscribe(what) raise "only valid on sub socket type (was #{@socket.name})" unless @socket.name == 'SUB' @socket.setsockopt(::XS::UNSUBSCRIBE, what) end |