Websocket

Installation Guide

The WebSocket API is very similar to the RPC API, the only difference is the way you connect to the Node. The method we recommend is to use wscat as a client for connecting to websockets. wscat can be installed using npm:

$ sudo npm install -g wscat 

Connect using the Bware Generated Endpoint

To connect to the endpoint, we will use the following command:

$ wscat -c wss://moonbeam-api.bwarelabs.com/ws/<your-endpoint-id>
Connected (press CTRL+C to quit)
>   

Simple Request Example

After Connected is shown, you can make a simple query like the following:

Connected (press CTRL+C to quit)

//Request
> {"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":53}

//Response
< {"jsonrpc": "2.0", "id": 1, "result": false}

Last updated