[Modify] Add it

This commit is contained in:
sta 2018-07-14 21:00:37 +09:00
parent eb21c505ca
commit b06f3a71c0

View File

@ -597,6 +597,31 @@ namespace WebSocketSharp.Server
_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>