Ejemplo n.º 1
0
        public async Task <ToAppResponse> AppRoomRequest(AppRoomRequest request)
        {
            ToAppResponse commonResponse;

            //验证是否是本人ID
            long uid = UserConnManager.GetUidByConn(Context.ConnectionId);

            if (request.Id != uid)
            {
                return(new ToAppResponse(null, ResponseStatus.Error, null));
            }
            var busClient = _bus.CreateRequestClient <AppRoomRequest>(new Uri($"{Configuration["Rabbitmq:Uri"]}{request.GameRoomKey}"), TimeSpan.FromSeconds(5));

            try
            {
                var busResponse = await busClient.GetResponseExt <AppRoomRequest, ToAppResponse>(request);

                commonResponse = busResponse?.Message;
            }
            catch (Exception)
            {
                return(new ToAppResponse(null, ResponseStatus.BusError, null));
            }
            return(commonResponse);
        }
Ejemplo n.º 2
0
        public ToAppResponse TestRequest(string test)
        {
            long uid = _userConnManager.GetUidByConn(Context.ConnectionId);

            return(new ToAppResponse(null, StatusCodeDefines.Success, null));
        }