obmarg / graphql-ws-client

A GraphQL over Websockets implementation for Rust
Apache License 2.0
39 stars 15 forks source link

Send graphql-transport-ws ping instead of websocket ping frame. #117

Closed szgupta closed 2 months ago

szgupta commented 3 months ago

Description

When using the new keepalive functionality, we noticed that the pings are sent as websocket ping frames rather than as graphql-transport-ws ping messages.

Aside from conforming to the protocol, the sub-protocol ping messages should be used to support a heartbeat mechanism from browser (i.e. wasm) clients, where there isn't a concept of ping / pong frames. Specifically, setting a KeepAliveSettings::interval from a browser client does not do anything right now.

Testing

Locally tested to confirm that the correct ping messages are now sent from browser clients (and that a gql-conforming server responds with the appropriate pong message).

obmarg commented 2 months ago

Thanks @szgupta - I've manually merged this in bb958cb since merging #116 introduced some conflicts

obmarg commented 2 months ago

Released in v0.10.2