poller – Poller

Device for polling sockets

class eventmq.poller.Poller(*args, **kwargs)

zmq.Poller based class.

__init__(*args, **kwargs)

See zmq.Poller

poll(timeout=1)

Calling zmq.Poller.poll() directly returns a tuple set. This method typecasts to a dictionary for convience using the socket object as the key. If a socket doesn’t appear in the returned dictionary then no events happened.

Parameters:timeout (int) – How long should poller wait for before iterating the next loop.
Returns (dict) Dictionary using the socket as the key and the event the
socket generated as the value
register(socket, flag=0)

Register a socket to be polled by this poller

Parameters:
  • socket (socket) – The socket object to register
  • flags (int) – POLLIN, POLLOUT, or POLLIN`|:attr:`POLLOUT for both. If undefined the socket remains unregistered.
unregister(socket)

Unregister a socket from being polled

Parameters:socket (socket) – The socket object to registering