sender – Sender

The sender is responsible for sending messages

class eventmq.sender.Sender(*args, **kwargs)

Sends messages to a particular socket

Note

Polling with this sender is currently only available via an eventloop (zmq.eventloop)

name

str – Name of this socket

zcontext (

class`zmq.Context`): socket context

zsocket

zmq.Socket – socket wrapped up in a zmqstream.ZMQStream

__init__(*args, **kwargs)

Note

All args are optional unless otherwise noted.

Parameters:
  • name (str) – name of this socket. By default a uuid will be generated
  • context (zmq.Context) – Context to use when building the socket
  • socket (zmq.Socket) – Should be one of zmq.REQ or zmq.DEALER. By default a DEALER is used
  • skip_zmqstream (bool) – If set to true, skip creating the zmqstream socket
__weakref__

list of weak references to the object (if defined)

connect(addr=None)

Connect to address defined by addr

Parameters:addr (str) – Address to connect to as a connection string
Raises:Exception
listen(addr=None)

start listening on addr

Parameters:addr (str) – Address to listen on as a connction string
Raises:Exception
ready

Property used to check if this receiver is ready.

Returns:True if the receiver is ready to connect or listen, otherwise False
Return type:bool
recv()

Receive a message

recv_multipart()

Receive a multipart message

send(message, protocol_version)

Sends a message

Parameters:
  • message – message to send to something
  • protocol_version (str) – protocol version. it’s good practice, but you may explicitly specify None to skip adding the version
send_multipart(message, protocol_version)

Send a message directly to the 0mq socket. Automatically inserts some frames for your convience. The sent frame ends up looking something like identity

(this, ‘’, protocol_version) + (your, tuple)
Parameters:
  • message (tuple) – Raw message to send.
  • protocol_version (str) – protocol version. it’s good practice but you may explicitly specify None to skip adding the version