コード例 #1
0
ファイル: WebSocketServer.cs プロジェクト: xdsuX/selenium
        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();
            }
        }
コード例 #2
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();
            }
        }