Esempio n. 1
0
        static void Main(string[] args)
        {
            _server = SuperWebSocketServer.GetIntance();

            _server.OnReceiveMessage += Server_OnReceiveMessage;
            _server.OnReceiveBytes   += Server_OnReceiveBytes;
            _server.OnClosed         += Server_OnClosed;

            WebSocketServerConfig config = new WebSocketServerConfig
            {
                ServerName = "WebSocketServerDemo",
                Port       = 58090,
            };

            Console.WriteLine("Starting...");

            var isSuccess = _server.Start(config);

            if (isSuccess)
            {
                Console.WriteLine("Starting Successful.");
            }
            else
            {
                Console.WriteLine("Starting Fail.");
            }

            Console.ReadKey();
        }
Esempio n. 2
0
        public static SuperWebSocketServer GetIntance()
        {
            if (_superWebSocketServer == null)
            {
                lock (_lockObj)
                {
                    if (_superWebSocketServer == null)
                    {
                        _superWebSocketServer = new SuperWebSocketServer();
                    }
                }
            }

            return(_superWebSocketServer);
        }