protected override HttpResponse Response(HttpRequest req)
        {
            var list = GameServiceRouter.GetAllRooms();

            var ret = JsonConvert.SerializeObject(list);

            return(new HttpResponse()
            {
                ContentType = "application/json", ByteArrayResponseBody = UTF8Encoding.UTF8.GetBytes(ret), ResponseBody = ret, SC = StatusCode.Ok
            });
        }
        protected override HttpResponse Response(HttpRequest req)
        {
            var roomType = req.QueryParameters["roomType"];
            var retid    = GameServiceRouter.CreateNewChatRoom(roomType);
            var ret      = JsonConvert.SerializeObject(retid);

            return(new HttpResponse()
            {
                ContentType = "application/json", ByteArrayResponseBody = UTF8Encoding.UTF8.GetBytes(ret), ResponseBody = ret, SC = StatusCode.Ok
            });
        }
        protected override void ClientStream(HttpRequest request, CPacheStream cPacheStream)
        {
            myStream = cPacheStream;
            var id = request.Url.Split("?roomid=")[1].Replace("%22", "");

            lock (GameServiceRouter.locker)
            {
                foreach (IGameRoom chatRoom in GameServiceRouter.GetAllRooms())
                {
                    if (chatRoom.instance == id)
                    {
                        ChatRoom = chatRoom;
                    }
                }
            }

            ChatRoom.subscribeToChat(cPacheStream);
        }
Exemplo n.º 4
0
        protected override HttpResponse Response(HttpRequest req)
        {
            var       roomid   = req.QueryParameters["roomid"].Replace("%22", "");
            IGameRoom chatRoom = null;

            foreach (var room in GameServiceRouter.GetAllRooms())
            {
                if (room.instance == roomid)
                {
                    chatRoom = room;
                }
            }
            var ret     = "gren";
            var JsonRet = Newtonsoft.Json.JsonConvert.SerializeObject(ret);

            return(new HttpResponse()
            {
                ContentType = "application/json", ByteArrayResponseBody = UTF8Encoding.UTF8.GetBytes(JsonRet), ResponseBody = JsonRet, SC = StatusCode.Ok
            });
        }