Beispiel #1
0
        // handle incoming clients
        private async Task HandleClient(ConnectionStream stream)
        {
            if (!(await HandshakeClient(stream)))
            {
                return;
            }
            WebsockServerClient serverClient = new WebsockServerClient(this, ref stream);

            clients.Add(serverClient);
            await serverClient.StartAsync();
        }
Beispiel #2
0
        // handle a new client connection
        private async Task HandleClient(TcpClient client, Stream stream)
        {
            // first, handshake with the client
            if (!(await HandshakeClient(client, stream)))
            {
                return;
            }

            // then, create client and add to stream
            WebsockServerClient serverClient = new WebsockServerClient(this, ref stream, ref client);

            clients.Add(serverClient);
            OnConnect(serverClient);
            await serverClient.StartAsync();
        }