Skip to content

How to connect the websocket mechanism and how to check that it is enabled from the outside? #12786

Discussion options

You must be logged in to vote

Websockets is enabled on the same port and URL as the HTTP endpoint - websockets is just an "upgrade" for an HTTP connection so the same port serves that purpose. If http://x.x.x.x:1234/rpc/v1 works, then ws://x.x.x.x:1234/rpc/v1 will work, unless you have something odd going on with your network or websockets library.

You can use a library like wscat to debug if you want, e.g.:

$ wscat -c ws://localhost:1234/rpc/v1 -x '{"method":"Filecoin.ChainHead","params":[],"id":2,"jsonrpc":"2.0"}'
{"id":2,"jsonrpc":"2.0","result":{"Cids":[{"/":"bafy2bzacebkij3dit4cvz7xhnxv76ggbbanigfapte5y3xdmwap74gfkp7m42"},{"/":"bafy2bzacea5apv66shtoxg6wdt36wt2u2wqlz74h3s2p3bvr6lrfbu5klau7w"},{"/":"bafy2bzaceaso3e…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@marisarze
Comment options

Answer selected by rvagg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants