Class: Pantry::Communication::PublishSocket

Inherits:
WritingSocket show all
Defined in:
lib/pantry/communication/publish_socket.rb

Overview

The PublishSocket handles the Publish side of Pub/Sub using a 0MQ PUB socket. Messages can be published to all listening clients or can be filtered to certain clients using a ClientFilter. See SubscribeSocket for the receiving end.

Instance Attribute Summary

Attributes inherited from WritingSocket

#host, #port

Instance Method Summary collapse

Methods inherited from WritingSocket

#close, #initialize, #open, #send_message

Constructor Details

This class inherits a constructor from Pantry::Communication::WritingSocket

Instance Method Details

#build_socketObject



10
11
12
# File 'lib/pantry/communication/publish_socket.rb', line 10

def build_socket
  Celluloid::ZMQ::PubSocket.new
end

#open_socket(socket) ⇒ Object



14
15
16
# File 'lib/pantry/communication/publish_socket.rb', line 14

def open_socket(socket)
  socket.bind("tcp://#{host}:#{port}")
end