From b06f3a71c0fb5bd01261195fadd52868c2d2cff3 Mon Sep 17 00:00:00 2001 From: sta Date: Sat, 14 Jul 2018 21:00:37 +0900 Subject: [PATCH] [Modify] Add it --- websocket-sharp/Server/WebSocketBehavior.cs | 25 +++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/websocket-sharp/Server/WebSocketBehavior.cs b/websocket-sharp/Server/WebSocketBehavior.cs index 2c0104aa..99a0b18c 100644 --- a/websocket-sharp/Server/WebSocketBehavior.cs +++ b/websocket-sharp/Server/WebSocketBehavior.cs @@ -597,6 +597,31 @@ namespace WebSocketSharp.Server _websocket.Close (code, reason); } + /// + /// Closes the WebSocket connection for a session asynchronously. + /// + /// + /// + /// This method does not wait for the close to be complete. + /// + /// + /// This method does nothing if the current state of the connection is + /// Closing or Closed. + /// + /// + /// + /// The session has not started yet. + /// + protected void CloseAsync () + { + if (_websocket == null) { + var msg = "The session has not started yet."; + throw new InvalidOperationException (msg); + } + + _websocket.CloseAsync (); + } + /// /// Calls the method with the specified message. ///