Skip to content

Commit 2d2ab4c

Browse files
authored
GraphQLWs: Ping messages reflect the payload in the pong response (#1155)
1 parent a84c553 commit 2d2ab4c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Transports.AspNetCore/WebSockets/GraphQLWs/SubscriptionServer.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ public override async Task OnMessageReceivedAsync(OperationMessage message)
123123
/// Executes when a ping message is received.
124124
/// </summary>
125125
protected virtual Task OnPingAsync(OperationMessage message)
126-
=> Connection.SendMessageAsync(_pongMessage);
126+
=> message.Payload == null
127+
? Connection.SendMessageAsync(_pongMessage)
128+
: Connection.SendMessageAsync(new OperationMessage { Type = MessageType.Pong, Payload = message.Payload });
127129

128130
/// <summary>
129131
/// Executes when a pong message is received.

0 commit comments

Comments
 (0)