From 0816ad97c559fcaa85d7f12aa187aa4b25bfdd21 Mon Sep 17 00:00:00 2001 From: sta Date: Mon, 1 Nov 2021 20:46:19 +0900 Subject: [PATCH] [Modify] Add it --- websocket-sharp/Server/WebSocketBehavior.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/websocket-sharp/Server/WebSocketBehavior.cs b/websocket-sharp/Server/WebSocketBehavior.cs index 49292c2a..6e47872e 100644 --- a/websocket-sharp/Server/WebSocketBehavior.cs +++ b/websocket-sharp/Server/WebSocketBehavior.cs @@ -833,6 +833,27 @@ namespace WebSocketSharp.Server { } + /// + /// Sends a ping 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. + /// + /// + /// The session has not started yet. + /// + protected bool Ping () + { + if (_websocket == null) { + var msg = "The session has not started yet."; + + throw new InvalidOperationException (msg); + } + + return _websocket.Ping (); + } + /// /// Sends the specified data to a client using the WebSocket connection. ///