Exemple #1
0
        private void OnClientConnect(ISocket clientSocket)
        {
            this.ListenForClients();

            WebSocketConnection connection = null;

            connection = new WebSocketConnection(clientSocket, this.scheme);
            connection.MessageReceived       += new EventHandler <TextMessageHandledEventArgs>(this.ConnectionMessageReceivedEventHandler);
            connection.BinaryMessageReceived += new EventHandler <BinaryMessageHandledEventArgs>(this.ConnectionBinaryMessageReceivedEventHandler);
            connection.Opened        += new EventHandler <ConnectionEventArgs>(this.ConnectionOpenedEventHandler);
            connection.Closed        += new EventHandler <ConnectionEventArgs>(this.ConnectionClosedEventHandler);
            connection.ErrorReceived += new EventHandler <ErrorEventArgs>(this.ConnectionErrorEventHandler);
            connection.StandardHttpRequestReceived += new EventHandler <StandardHttpRequestReceivedEventArgs>(this.ConnectionStandardHttpRequestReceivedEventHandler);

            if (this.IsSecure)
            {
                clientSocket.Authenticated += new EventHandler(this.SocketAuthenticatedEventHandler);
                clientSocket.Authenticate(this.authenticationX509Certificate);
            }
            else
            {
                connection.StartReceiving();
            }
        }
        private void OnClientConnect(ISocket clientSocket)
        {
            this.ListenForClients();

            WebSocketConnection connection = null;
            connection = new WebSocketConnection(clientSocket, this.scheme);
            connection.MessageReceived += new EventHandler<TextMessageHandledEventArgs>(this.ConnectionMessageReceivedEventHandler);
            connection.BinaryMessageReceived += new EventHandler<BinaryMessageHandledEventArgs>(this.ConnectionBinaryMessageReceivedEventHandler);
            connection.Opened += new EventHandler<ConnectionEventArgs>(this.ConnectionOpenedEventHandler);
            connection.Closed += new EventHandler<ConnectionEventArgs>(this.ConnectionClosedEventHandler);
            connection.ErrorReceived += new EventHandler<ErrorEventArgs>(this.ConnectionErrorEventHandler);
            connection.StandardHttpRequestReceived += new EventHandler<StandardHttpRequestReceivedEventArgs>(this.ConnectionStandardHttpRequestReceivedEventHandler);

            if (this.IsSecure)
            {
                clientSocket.Authenticated += new EventHandler(this.SocketAuthenticatedEventHandler);
                clientSocket.Authenticate(this.authenticationX509Certificate);
            }
            else
            {
                connection.StartReceiving();
            }
        }