sta / websocket-sharp

A C# implementation of the WebSocket protocol client and server
http://sta.github.io/websocket-sharp
MIT License
5.74k stars 1.66k forks source link

How to send Pong? #719

Open Zeddex opened 1 year ago

Zeddex commented 1 year ago

When I get ping I need to send back pong. But I can't find any possibility to do this.

private void OnMessage(object sender, MessageEventArgs e) { if (e.IsPing) { _ws.Send(Opcode.Pong); // or something like that } }

apdevelop commented 1 year ago

There is internal function WebSocketFrame.CreatePongFrame If I understood correctly, the pong response will be sent automatically.