-
Notifications
You must be signed in to change notification settings - Fork 45
ZeroMQ
Beau Barker edited this page Jul 4, 2025
·
2 revisions
Zero MQ client.
import logging
import zmq
from jsonrpcclient import Ok, parse_json, request_json
socket = zmq.Context().socket(zmq.REQ)
socket.connect("tcp://localhost:5000")
socket.send_string(request_json("ping"))
response = parse_json(socket.recv().decode())
# Python 3.10+ should use `match` syntax here
if isinstance(response, Ok):
print(response.result)
else:
logging.error(response.message)
Reference: JSON-RPC in ZeroMQ.
Contributions are appreciated – simply hit Edit or New page.