def handle_socket(socket): print("Socket: [%s]> %s" % (time(), encode(socket))) name = socket.get("name", None) data = socket.get("data", None) owner = socket.get("owner", None) if owner is not None: emit("message", data, room=owner)
def test_response(self, socket=i3.default_socket()): workspaces = socket.get('get_workspaces') self.assertIsNotNone(workspaces) for workspace in workspaces: self.assertTrue('name' in workspace)
def zmq_readable(self, eventfd, condition, socket, callback): while socket.get(zmq.EVENTS) & zmq.POLLIN: callback(socket) return True
def has_data(socket): return socket.get(zmq.EVENTS) & zmq.POLLIN