Ejemplo n.º 1
0
        private static void TestClient(object state)
        {
            try
            {
                string url = (string)state;
                using (var client = new ChatWebSocketClient(true, _logger))
                {
                    Uri uri = new Uri(url);
                    client.TextFrame        += Client_TextFrame;
                    client.ConnectionOpened += Client_ConnectionOpened;

                    // test the open handshake
                    client.OpenBlocking(uri);
                }

                _logger.Information(typeof(Program), "Client finished, press any key");
            }
            catch (Exception ex)
            {
                _logger.Error(typeof(Program), ex.ToString());
                _logger.Information(typeof(Program), "Client terminated: Press any key");
            }

            Console.ReadKey();
        }
Ejemplo n.º 2
0
        private static void TestClient(object state)
        {
            var logger = (IWebSocketLogger)state;

            using (var client = new ChatWebSocketClient(true, logger))
            {
                Uri uri = new Uri("ws://localhost/chat");
                client.TextFrame        += Client_TextFrame;
                client.ConnectionOpened += Client_ConnectionOpened;

                // test the open handshake
                client.OpenBlocking(uri);
            }

            Trace.TraceInformation("Client finished, press any key");
            Console.ReadKey();
        }