-
Is there a way to filter out a client (or multiple clients) and send message only to them? An example would be an image with QR code: user clicks on a button, some calculations happen on server and then I'd like to send QR image to that specific client that made the click. Each client has an UUID so I could do a filter based on that. Returning false or null in onNext() doesn't seem to help and throwing error closes connections. Is there some other way that I failed to see? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
This is GraphQL WebSocket library, so you may achieve that only through GraphQL. A subscription would look roughly like this: subscription {
onQRAvailable(key: "unique key of client") {
qrCodeData
}
} and them emit the event through GQL matching the key of the client. However, a better question is: why even use WebSockets for this? Why not use HTTP which is meant for activities like the one you're describing - an HTTP request on button click whose response is the QR image data. |
Beta Was this translation helpful? Give feedback.
This is GraphQL WebSocket library, so you may achieve that only through GraphQL. A subscription would look roughly like this:
and them emit the event through GQL matching the key of the client.
However, a better question is: why even use WebSockets for this? Why not use HTTP which is meant for activities like the one you're describing - an HTTP request on button click whose response is the QR image data.