Skip to content

Commit

Permalink
[Modify] Add it
Browse files Browse the repository at this point in the history
  • Loading branch information
sta committed Jul 14, 2018
1 parent eb21c50 commit b06f3a7
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions websocket-sharp/Server/WebSocketBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,31 @@ protected void Close (CloseStatusCode code, string reason)
_websocket.Close (code, reason);
}

/// <summary>
/// Closes the WebSocket connection for a session asynchronously.
/// </summary>
/// <remarks>
/// <para>
/// This method does not wait for the close to be complete.
/// </para>
/// <para>
/// This method does nothing if the current state of the connection is
/// Closing or Closed.
/// </para>
/// </remarks>
/// <exception cref="InvalidOperationException">
/// The session has not started yet.
/// </exception>
protected void CloseAsync ()
{
if (_websocket == null) {
var msg = "The session has not started yet.";
throw new InvalidOperationException (msg);
}

_websocket.CloseAsync ();
}

/// <summary>
/// Calls the <see cref="OnError"/> method with the specified message.
/// </summary>
Expand Down

0 comments on commit b06f3a7

Please sign in to comment.