Ejemplo n.º 1
0
        public static void RegisterLiveActions(int roomID)
        {
            if (actionSockets.ContainsKey(roomID))
            {
                return;
            }
            var socket = IO.Socket(VMT_URL);

            actionSockets[roomID] = socket;

            socket.On(Socket.EVENT_CONNECT, () =>
            {
                socket.Emit("observeRoom", "room" + roomID.ToString());
                Debug.WriteLine(String.Format("RegisterLiveActions({0}) | User Connected!", roomID));
            });
            socket.On(Socket.EVENT_DISCONNECT, () =>
            {
                socket.Emit("user disconnected");
                Debug.WriteLine(String.Format("RegisterLiveActions({0}) | User Disconnected!", roomID));
            });


            var listener = new FourArgumentsListener((eventName, actID, url, log) =>
            {
                Debug.WriteLine(String.Format("RegisterLiveActions({0}) | New Action!", roomID));
                ctrl.ResetState();
                ctrl.HandleLiveAction(actID.ToString(), url.ToString(), log.ToString(), eventName.ToString(), roomID);
            });

            socket.On("ccAction", listener);
        }