Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
 protected void OnHandshakeSuccess(object sender, WebSocketConnectionEventArgs e)
 {
     if (HandshakeSuccess != null)
     {
         HandshakeSuccess(sender, e);
     }
 }
Ejemplo n.º 3
0
 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);
 }
Ejemplo n.º 4
0
 private void HandshakeFailedHandler(object sender, WebSocketConnectionEventArgs e)
 {
     OnConnectionFailed(this, e);
 }
Ejemplo n.º 5
0
 protected void OnConnectionFailed(object sender, WebSocketConnectionEventArgs e)
 {
     if (ConnectionFailed != null)
     {
         ConnectionFailed(sender, e);
     }
 }
Ejemplo n.º 6
0
        public WebSocketConnection ConnectAsServer(NetworkStream stream, bool skipHandshaking)
        {
            var connection = CreateNewConnection(stream);

            var e = new WebSocketConnectionEventArgs(connection, stream);
            OnConnectionAccepted(this, e);

            return connection;
        }