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

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

            return connection;
        }