Is there a way to Http Authentication with WebSocket4Net? I would like to pass credentials to my client. This is what my code looks like:
public bool Connect(string uri, ICredentials credentials = null)
{
if (this.ws == null)
{
try
{
////this.ws = new WebSocket(uri, string.Empty, WebSocketVersion.None, null, );
this.ws = new WebSocket(uri);
this.ws.Opened += this.OnWebSocketOpen;
this.ws.Closed += this.OnWebSocketClose;
this.ws.Error += this.OnWebSocketFail;
this.ws.MessageReceived += this.OnWebSocketMessage;
try
{
this.ws.Open();
return true;
}
catch (Exception ex)
{
Log.Error("Open web socket failed", ex);
this.ws = null;
}
}
catch (Exception exception)
{
throw new CanNotConnectToDeviceException(new Uri(uri, UriKind.Relative), exception);
}
}
return false;
}