示例#1
0
        static void Main(string[] args)
        {
            // connect to /wsock websocket server
            m_ws            = new WebSocket(url: "ws://localhost:8080/wsock");
            m_ws.OnMessage += (sender, e) =>
            {
                Console.WriteLine(e.Data);
                byte[] data = e.RawData;
            };

            System.Console.WriteLine("Start Relay Server");
            System.Console.WriteLine("Try Connect Websocket~~");

            m_ws.Connect();
            m_ws.Send("c# Test");

            System.Console.WriteLine("Success Connect Websocket");

            RelayServer server = new RelayServer();

            server.Start(10002, PacketHandler);

            System.Console.WriteLine("Disconnect");
            System.Console.WriteLine("Finish Relay Server");
        }
        static void Main(string[] args)
        {
            m_ws            = new WebSocket(url: "ws://localhost:8080/chat");
            m_ws.OnMessage += (sender, e) =>
            {
                Console.WriteLine(e.Data);
                byte[] data = e.RawData;
            };

            m_ws.Connect();
            m_ws.Send("c# Test");
            //while (ws.IsAlive)
            //    System.Threading.Thread.Sleep(1000);

            RelayServer server = new RelayServer();

            server.Start(10002, PacketHandler);
        }