Skip to content

Commit

Permalink
server response to ping with pong with payload
Browse files Browse the repository at this point in the history
  • Loading branch information
michelepra committed Jun 9, 2021
1 parent 37720c6 commit 3436d5b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,8 @@ export function makeServer<E = unknown>(options: ServerOptions<E>): Server<E> {
return;
}
case MessageType.Ping: {
await socket.send(stringifyMessage({ type: MessageType.Pong }));
const payload = message.payload;
await socket.send(stringifyMessage(payload? { type: MessageType.Pong, payload } : { type: MessageType.Pong }));
return;
}
case MessageType.Pong:
Expand Down

0 comments on commit 3436d5b

Please sign in to comment.