Skip to main content

WebSocket Subscriptions

Websocket Subscriptions (v0.38.x)

Download OpenAPI specification:Download

JSONRPC/websockets

JSONRPC requests can be also made via websocket. The websocket endpoint is at /websocket, e.g. https://pio-mainnet-1-rpc.provlabs.com/websocket. Asynchronous RPC functions like event subscribe and unsubscribe are only available via websockets.

For example using the websocat tool, you can subscribe for 'NewBlock` events with the following command:

echo '{ "jsonrpc": "2.0","method": "subscribe","id": 0,"params": {"query": "tm.event='"'NewBlock'"'"} }' | websocat -n -t wss://pio-mainnet-1-rpc.provlabs.com/websocket