From 7ae8de1c67ac00f67eed076b4935ff2cf0c97e6c Mon Sep 17 00:00:00 2001 From: sta Date: Fri, 6 Jul 2018 19:58:33 +0900 Subject: [PATCH] [Modify] Add it --- websocket-sharp/Server/WebSocketBehavior.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/websocket-sharp/Server/WebSocketBehavior.cs b/websocket-sharp/Server/WebSocketBehavior.cs index 23f5cf26..625c58d7 100644 --- a/websocket-sharp/Server/WebSocketBehavior.cs +++ b/websocket-sharp/Server/WebSocketBehavior.cs @@ -450,6 +450,26 @@ namespace WebSocketSharp.Server #region Protected Methods + /// + /// Closes the WebSocket connection for a session. + /// + /// + /// This method does nothing if the current state of the connection is + /// Closing or Closed. + /// + /// + /// The session has not started yet. + /// + protected void Close () + { + if (_websocket == null) { + var msg = "The session has not started yet."; + throw new InvalidOperationException (msg); + } + + _websocket.Close (); + } + /// /// Calls the method with the specified message. ///