class Pantry::Communication::WritingSocket
Base class of all sockets that write messages through ZMQ. Not meant for direct use, please use one of the subclasses for specific functionality.
Attributes
host[R]
port[R]
Public Class Methods
new(host, port, security)
click to toggle source
# File lib/pantry/communication/writing_socket.rb, line 12 def initialize(host, port, security) @host = host @port = port @security = security end
Public Instance Methods
build_socket()
click to toggle source
# File lib/pantry/communication/writing_socket.rb, line 26 def build_socket raise "Implement the socket setup." end
close()
click to toggle source
# File lib/pantry/communication/writing_socket.rb, line 34 def close @socket.close if @socket end
open()
click to toggle source
# File lib/pantry/communication/writing_socket.rb, line 18 def open @socket = build_socket Communication.configure_socket(@socket) @security.configure_socket(@socket) open_socket(@socket) end
open_socket(socket)
click to toggle source
# File lib/pantry/communication/writing_socket.rb, line 30 def open_socket(socket) raise "Connect / Bind the socket built in #build_socket" end
send_message(message)
click to toggle source
# File lib/pantry/communication/writing_socket.rb, line 38 def send_message(message) @socket.write( SerializeMessage.to_zeromq(message) ) end