diff --git a/src/Transports.AspNetCore/WebSockets/GraphQLWs/SubscriptionServer.cs b/src/Transports.AspNetCore/WebSockets/GraphQLWs/SubscriptionServer.cs index 3235d16c..70c8e5ec 100644 --- a/src/Transports.AspNetCore/WebSockets/GraphQLWs/SubscriptionServer.cs +++ b/src/Transports.AspNetCore/WebSockets/GraphQLWs/SubscriptionServer.cs @@ -123,7 +123,9 @@ public override async Task OnMessageReceivedAsync(OperationMessage message) /// Executes when a ping message is received. /// protected virtual Task OnPingAsync(OperationMessage message) - => Connection.SendMessageAsync(_pongMessage); + => message.Payload == null + ? Connection.SendMessageAsync(_pongMessage) + : Connection.SendMessageAsync(new OperationMessage { Type = MessageType.Pong, Payload = message.Payload }); /// /// Executes when a pong message is received.