Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
When configuring a ping-pong interval on a web socket, it requires each web socket connection to send pings, and receive pongs. To make sure that gqlgen receives the pongs in time, a read deadline is set on the websocket connection. This functions fine as long as the
graphql-transport-ws
sub protocol is used. However, when using thegraphql-ws
sub protocol, it causes i/o timeout errors.The reason that there are timeout errors when
graphql-ws
is used with a configured ping-pong interval is quite simple;graphql-ws
does not support ping-pong messages.So, to fix this, we just disable the whole ping-pong mechanism when using
graphql-ws
!What does this PR exactly do?
pingMesageType
=>pingMessageType
)websocket_graphqlws.go
file to look more like the code in thewebsocket_graphql_transport_ws.go
file (for the sake of consistency)if
statements in the websocket code that make sure that thekeepAlive
messages, as well as the ping messages, only get send when their corresponding sub protocol is selected (keep-alive =>graphql-transport-ws
, ping =>graphql-ws
)Some extra details
The full server error is
read tcp x.x.x.x:x->x.x.x.x:x: i/o timeout
, and the full client error isinvalid close code
.I have:
Not needed: