All DEPLOY nodes have WebSocket support enabled by default. wscat is a tool for connecting to and communicating with a WebSockets server. The instructions below will guide you through opening up a simple WebSocket connection with a DEPLOY node:

1. Make sure you have wscat installed locally:

$ npm install -g wscat

2. Open the WebSocket connection with your node:

wscat -connect 'wss://shared-parity-mainnet.nodes.deploy.radar.tech/ws?apikey=YOUR_API_KEY'

The above example is for a Parity (Ethereum) Shared Node but the same syntax applies to all DEPLOY nodes.

Response: Once a successful connection has been opened you'll see the following:

Connected (press CTRL+C to quit)

3. Initiate Subscription or Pass JSON-RPC Methods:

Once the connection has been opened you can start to pass commands via WebSockets. Below is a common example to subscribe to transactions:

{"jsonrpc":"2.0", "id": 1, "method": "eth_subscribe", "params": ["newPendingTransactions"]}

The above example is specific to Ethereum nodes.

All WebSocket connections remain open without interaction for a maximum of 60 seconds. If you've subscribed to an event the connection will remain open until you close it.