Skip to content

Required a WebSocket RPC for Polygon-Edge Chain #509

Answered by lazartravica
Noooblien asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @rahul-spirit

Here are the basic steps for instantiating a WS connection:

You can use this tool for testing WS quickly:
https://github.com/vi/websocat

By default when you run the polygon SDK, it sets up the WS interface, so there is no need to additionally configure it

Opening a WS connection with websocat tool:

websocat ws://127.0.0.1:8545/ws

👆

This is for a localhost where the HTTP port is 8545. Notice the /ws at the end.

After you’ve opened up the WS connection, you can query it like the regular JSON RPC, by sending a json request to the open connection, for example:

{“id”:1, “jsonrpc”: “2.0”, “method”:“eth_blockNumber”,“params”:[]}

Let me know how that goes and whether you nee…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Noooblien
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Questions about Polygon Edge
2 participants
Converted from issue

This discussion was converted from issue #507 on April 20, 2022 13:10.