Esempio n. 1
0
        public void Start(IScene scene)
        {
            Scene = scene;

            Scheduler = scene.Simian.GetAppModule <IScheduler>();
            if (Scheduler == null)
            {
                m_log.Error("Cannot start WebSockets without an IScheduler");
                throw new InvalidOperationException();
            }

            MessageEvents = new MessageEventDictionary(Scheduler);

            try
            {
                Server               = new WebSocketServer(this);
                Server.Connected    += ConnectedHandler;
                Server.Disconnected += DisconnectedHandler;
                Server.DataReceived += DataReceivedHandler;

                Server.Start(12000, "http://localhost:12000", "ws://localhost:12000/");
            }
            catch (Exception ex)
            {
                m_log.Error("WebSocket server failed to start: " + ex.Message);
            }
        }
Esempio n. 2
0
        public void Start(IScene scene)
        {
            Scene = scene;

            Scheduler = scene.Simian.GetAppModule<IScheduler>();
            if (Scheduler == null)
            {
                m_log.Error("Cannot start WebSockets without an IScheduler");
                throw new InvalidOperationException();
            }

            MessageEvents = new MessageEventDictionary(Scheduler);

            try
            {
                Server = new WebSocketServer(this);
                Server.Connected += ConnectedHandler;
                Server.Disconnected += DisconnectedHandler;
                Server.DataReceived += DataReceivedHandler;

                Server.Start(12000, "http://localhost:12000", "ws://localhost:12000/");
            }
            catch (Exception ex)
            {
                m_log.Error("WebSocket server failed to start: " + ex.Message);
            }
        }