enisdenjo / graphql-ws

Coherent, zero-dependency, lazy, simple, GraphQL over WebSocket Protocol compliant server and client.
https://the-guild.dev/graphql/ws
MIT License
1.73k stars 156 forks source link

blocked websocket / delayed messages? #308

Closed louisholley closed 2 years ago

louisholley commented 2 years ago

not entirely sure if this is a graphql-ws issue but I'm really struggling to figure out what's going on and don't know where else to seek advice...

I'm using graphql-ws for a messaging platform, and I have two identical urql clients set up - one in a nextjs app and one in a react native app. I've got both clients connected to the server and I'm testing having a conversation between the two. The situation is as follows:

conversation according to the next app:

image

conversation according to the react native app:

image

what doesn't make sense to me is that the urql clients are setup in exactly the same way, and the react native app is receiving the messages fine without this weird blocking/delay. our backend is severless and the messages are enqueued and published to subscribers in the correct order as the react native app screenshot shows, so it seems unlikely to me that this could be a server issue. I'm wondering if anyone has ever experienced anything like this and has any advice wrt debugging and resolving this issue? I don't even know where to start! hoping this is allowed as I'm completely in the dark as to how to proceed...

thanks so much in advance!

louisholley commented 2 years ago

it's worth adding: an even weirder thing is that the mutation to send the message uses a separate client to the subscription client, so it's baffling that the subscription client only receives its next message when these mutations happen