[Modify] Add it

This commit is contained in:
sta 2020-12-24 22:46:42 +09:00
parent ff81a0ac6b
commit 86921077de

View File

@ -240,6 +240,30 @@ namespace WebSocketSharp.Net
return true;
}
internal HttpListenerWebSocketContext GetWebSocketContext (string protocol)
{
if (_websocketContext != null)
return _websocketContext;
if (protocol != null) {
if (protocol.Length == 0) {
var msg = "An empty string.";
throw new ArgumentException (msg, "protocol");
}
if (!protocol.IsToken ()) {
var msg = "It contains an invalid character.";
throw new ArgumentException (msg, "protocol");
}
}
_websocketContext = new HttpListenerWebSocketContext (this, protocol);
return _websocketContext;
}
internal bool Register ()
{
return _listener.RegisterContext (this);