Payload on pings #575
-
StoryWe are implementing a chat. User messages to the chat are mutations, and chat messages by other users are delivered back to the user via a subscription over graphql-ws. We'd like to know when the user is disconnected. For that we want to use keep-alive functionality. But there are additional transient metadata that we'd like to deliver to the server (e.g. "user is typing"). This would fit nicely into the optional https://github.com/enisdenjo/graphql-ws/blob/master/PROTOCOL.md#ping We don't want to use mutations for that because these events are too frequent, and processing a separate request just for that is expensive. Acceptance criteria
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Yes, the ping and pong payloads is ideal for this scenario. As inspiration, you can advise the "client usage with manual pings and pongs" recipe for implementing a client side pinger and "server usage with ws and subprotocol pings and pongs" recipe for server side. |
Beta Was this translation helpful? Give feedback.
Yes, the ping and pong payloads is ideal for this scenario. As inspiration, you can advise the "client usage with manual pings and pongs" recipe for implementing a client side pinger and "server usage with ws and subprotocol pings and pongs" recipe for server side.