Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpc: ensure WS server/client supports ping/pong protocol #170

fabioberger opened this issue Jun 15, 2019 · 2 comments · Fixed by #162


Copy link

@fabioberger fabioberger commented Jun 15, 2019

In order to allow Mesh WS clients to know if their connection to the server has been disrupted, we want to make sure that the WS server we are using supports the ping and pong frames specified by the WebSocket specification.

Additionally, we want to make sure that popular WS clients in Golang, Javascript and Python also support them. If not, we will need to add explicit support for ping/pong to our JSON/RPC API implementation.


This comment has been minimized.

Copy link
Contributor Author

@fabioberger fabioberger commented Jun 18, 2019

Update: Looks like the WebSocket library used by go-ethereums rpc implementation (and therefore Mesh's) will respond to ping frames with a pong response but never send pings itself: golang/go#5958. Therefore it's up to clients to send ping frames on a regular interval.

Next steps: Check for the prevalence of ping support in WS clients in Go, JS & Python.


This comment has been minimized.

Copy link
Contributor Author

@fabioberger fabioberger commented Jun 19, 2019

Update 2: In doing more research I've found the following:

  • Despite the underlying WebSocket library used by go-ethereum having support for PING/PONG frames, the go-ethereum WS client does not support sending anything but Text frames... We would need to refactor the implementation to add support for PING frames and then additionally add logic to periodically send PING frames in order to check that the connection is still alive.
  • web3-providers's WebSocketProvider also does not support sending ping frames, and it's underlying websocket library only uses it in it's Server implementation (to keep connections alive), not it's WS Client implementation.
  • The WebSocketProvider does send ping frames 🎊
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.