Пример #1
0
        public static async Task HandleConnection(WebSocket webSocket)
        {
            if (HostProcess.Token.IsCancellationRequested)
            {
                HostProcess = new HostProcess();
            }

            HostProcess.AddClient(webSocket);
            var clientSession = new ClientSession(webSocket, HostProcess);

            try
            {
                await clientSession.Process();
            }
            catch (Exception)
            {
                // todo
            }

            HostProcess.RemoveClient(webSocket);
        }
Пример #2
0
 public ClientSession(WebSocket webSocket, HostProcess host)
 {
     _webSocket = webSocket;
     _host      = host;
 }