예제 #1
0
        public Task OnGameRoomRequest(ConsumeContext <GameServerRequest> context)
        {
            GameServerRequest serverReq = context.Message;
            string            conn      = _userConnManager.GetConnByUid(serverReq.Id);

            if (conn == null)
            {
                return(Task.CompletedTask);
            }
            ToAppRoomRequest req = _mapper.Map <ToAppRoomRequest>(serverReq);

            return(_appHubContext.Clients.Clients(conn).SendAsync("ToAppRoomRequest", req));
        }
        public Task OnServerRequest(ConsumeContext <ServerRequest> context)
        {
            ServerRequest serverReq = context.Message;
            string        conn      = UserConnManager.GetConnByUid(serverReq.Id);

            if (conn == null)
            {
                return(Task.CompletedTask);
            }
            ToAppRequest req = _mapper.Map <ToAppRequest>(context.Message);

            return(_appHubContext.Clients.Clients(conn).SendAsync("ToAppRequest", req));
            //var response = await _rpcCaller.RequestCallAsync(conn, "ToAppRequest", JsonConvert.SerializeObject(req), req.MessageId);
            //await context.RespondAsync<BodyResponse<NullBody>>(response);
        }