obmarg / graphql-ws-client

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

feat: send periodic pings for keep alives #103

Closed obmarg closed 5 months ago

obmarg commented 5 months ago

93 & #94 added a notion of keep alives to graphql-ws-client. But the implementation caused the connection to drop whenever no messages were received for the specified period. This isn't how I'd usually expect a keep alive to work though - I'd usually expect it to send pings during inactive periods, and only drop the connection if a few of those pings were not replied to.

This PR implements that behaviour instead. It's a slightly breaking change over the earlier implementation, but that was not yet released so that seems fine.