Class: BZMQ::SubSocket

Inherits:
Socket
  • Object
show all
Defined in:
lib/bzmq/sockets.rb

Instance Method Summary collapse

Methods inherited from Socket

#bind, #close, #connect, #read, #write

Constructor Details

#initialize(options = {}) ⇒ SubSocket

Returns a new instance of SubSocket.



46
47
48
# File 'lib/bzmq/sockets.rb', line 46

def initialize(options={})
  super(ZMQ::SUB, options)
end

Instance Method Details

#subscribe(topic) ⇒ Object



50
51
52
# File 'lib/bzmq/sockets.rb', line 50

def subscribe(topic)
  error_check { @socket.setsockopt(::ZMQ::SUBSCRIBE, topic) }
end

#unsubscribe(topic) ⇒ Object



54
55
56
# File 'lib/bzmq/sockets.rb', line 54

def unsubscribe(topic)
  error_check { @socket.setsockopt(::ZMQ::UNSUBSCRIBE, topic) }
end