diff --git a/websocket-sharp/Server/WebSocketBehavior.cs b/websocket-sharp/Server/WebSocketBehavior.cs index 6e47872e..b2a5dd21 100644 --- a/websocket-sharp/Server/WebSocketBehavior.cs +++ b/websocket-sharp/Server/WebSocketBehavior.cs @@ -854,6 +854,42 @@ namespace WebSocketSharp.Server return _websocket.Ping (); } + /// + /// Sends a ping with the specified message to a client using + /// the WebSocket connection. + /// + /// + /// true if the send has done with no error and a pong has been + /// received within a time; otherwise, false. + /// + /// + /// + /// A that specifies the message to send. + /// + /// + /// The size must be 125 bytes or less in UTF-8. + /// + /// + /// + /// The session has not started yet. + /// + /// + /// could not be UTF-8-encoded. + /// + /// + /// The size of is greater than 125 bytes. + /// + protected bool Ping (string message) + { + if (_websocket == null) { + var msg = "The session has not started yet."; + + throw new InvalidOperationException (msg); + } + + return _websocket.Ping (message); + } + /// /// Sends the specified data to a client using the WebSocket connection. ///