How to ensure that no subscription response goes undelivered ? #175
-
Use caseI have a graphql-ws implementation set with retry attempts incase of network issues, or authToken expiry, built using this example https://github.com/enisdenjo/graphql-ws#auth-token Because of the following issues, it can happen that a client doesnt receive the message even though the server has published it :
For a critical use case like a chat app or a data sync, this will lead to some inconsistencies. TL;DR -> All payloads passing graphqls How can this problem be addressed ? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
Hey hey, lets jump straight to it. Check the "Server usage with ws" recipe which showcases a commented, super simple, integration of
Implementing a "missed" queue to either case from above is possible. For example:
This will work because the client will always resubscribe with the same ID of the subscription that was abruptly terminated. However, be very careful of how you identify your clients! You dont want to drain the queue to a potential attacker that impersonates the original client by using the same subscription IDs. Nevertheless, with good security practises on the connecting phase, you can be quite safe with the queue draining through the right sink simply because |
Beta Was this translation helpful? Give feedback.
Hey hey, lets jump straight to it.
graphql-ws
is designed to not swallow anything, it will fail if you try sending a message over a closed socket. Therefore, you will be fully aware of any untimely sends and are free to implement your own WS server that is more robust in this area throughmakeServer
.Check the "Server usage with ws" recipe which showcases a commented, super simple, integration of
ws
withgraphql-ws
.cb
argument ino…