graphql-ws-client
graphql-ws-client copied to clipboard
Return a specific type from `streaming_operation`.
AsyncWebsocketClient::streaming_operation currently returns an anonymous Stream type. This is fine for reading the results of a subscription, but there's a few things it can't support:
- Stopping the subscription (arguably dropping the stream might do this, although not sure if it's handled very cleanly).
- Checking why a stream ended.
Ideally we'd return a custom type that implements Stream but also:
- Provides a stop function.
- Stops the subscription cleanly on drop.
- Provides a way to check whether the subscription stopped "cleanly" or because of some sort of connectivity error etc.
There's a allow(dead_code) on the Message::Complete variant that can be removed once we have support for explicitly ending subscriptions.