protected void OnHandshakeFailed(object sender, WebSocketConnectionEventArgs e) { var sw = new StreamWriter(_stream); sw.WriteLine("HTTP/1.1 404 Not Found"); sw.WriteLine(); sw.Flush(); sw.Close(); if (HandshakeFailed != null) { HandshakeFailed(sender, e); } }
protected void OnHandshakeSuccess(object sender, WebSocketConnectionEventArgs e) { if (HandshakeSuccess != null) { HandshakeSuccess(sender, e); } }
private void HandshakeSuccessHandler(object sender, WebSocketConnectionEventArgs e) { var connection = CreateNewConnection(e.Stream); e.Connection = connection; var hd = GetBinding(e.Uri); if (hd.ConnectionSuccessHandler != null) { hd.ConnectionSuccessHandler(this, e); } OnConnectionAccepted(this, e); }
private void HandshakeFailedHandler(object sender, WebSocketConnectionEventArgs e) { OnConnectionFailed(this, e); }
protected void OnConnectionFailed(object sender, WebSocketConnectionEventArgs e) { if (ConnectionFailed != null) { ConnectionFailed(sender, e); } }
public WebSocketConnection ConnectAsServer(NetworkStream stream, bool skipHandshaking) { var connection = CreateNewConnection(stream); var e = new WebSocketConnectionEventArgs(connection, stream); OnConnectionAccepted(this, e); return connection; }