diff --git a/server/src-lib/Hasura/GraphQL/Transport/WebSocket.hs b/server/src-lib/Hasura/GraphQL/Transport/WebSocket.hs index dd97b7a705e..23b643bea05 100644 --- a/server/src-lib/Hasura/GraphQL/Transport/WebSocket.hs +++ b/server/src-lib/Hasura/GraphQL/Transport/WebSocket.hs @@ -1004,7 +1004,7 @@ onMessage env enabledLogTypes authMode serverEnv wsConn msgRaw onMessageActions CMStop stopMsg -> onStop serverEnv wsConn stopMsg -- specfic to graphql-ws CMPing mPayload -> onPing wsConn mPayload - CMPong mPayload -> onPong wsConn mPayload + CMPong _mPayload -> pure () -- specific to apollo clients CMConnTerm -> liftIO $ WS.closeConn wsConn "GQL_CONNECTION_TERMINATE received" where @@ -1016,14 +1016,6 @@ onPing :: (MonadIO m) => WSConn -> Maybe PingPongPayload -> m () onPing wsConn mPayload = liftIO $ sendMsg wsConn (SMPong mPayload) -onPong :: (MonadIO m) => WSConn -> Maybe PingPongPayload -> m () -onPong wsConn mPayload = liftIO $ case mPayload of - Just message -> - when (message /= keepAliveMessage) $ - sendMsg wsConn (SMPing mPayload) - -- NOTE: this is done to avoid sending Ping for every "keepalive" that the server sends - Nothing -> sendMsg wsConn $ SMPing Nothing - onStop :: (MonadIO m) => WSServerEnv -> WSConn -> StopMsg -> m () onStop serverEnv wsConn (StopMsg opId) = liftIO $ do -- When a stop message is received for an operation, it may not be present in OpMap diff --git a/server/tests-py/context.py b/server/tests-py/context.py index 0c78ef13ab4..78a4505ff8e 100644 --- a/server/tests-py/context.py +++ b/server/tests-py/context.py @@ -280,6 +280,9 @@ class GraphQLWSClient(): if json_msg['type'] == 'ping': new_msg = json_msg new_msg['type'] = 'pong' + # Decline to reflect the payload of the ping, because the + # graphql-ws specification does not require it + new_msg.pop('payload') self.send(json.dumps(new_msg)) return