コード例 #1
0
        public async Task <object> Subscribe(string service, double accountId)
        {
            TypedObject body = WrapBody(new TypedObject(), "messagingDestination", 0);

            body.type = "flex.messaging.messages.CommandMessage";
            TypedObject headers = body.GetTO("headers");

            if (service == "bc")
            {
                headers.Add("DSSubtopic", "bc");
            }
            else
            {
                headers.Add("DSSubtopic", service + "-" + accountID);
            }
            headers.Remove("DSRequestTimeout");
            body["clientId"] = service + "-" + accountID;
            int Id = Invoke(body);

            while (!results.ContainsKey(Id))
            {
                await Task.Delay(10);
            }

            TypedObject result = GetResult(Id); // Read result and discard

            return(null);
        }
コード例 #2
0
        public async Task <object> Subscribe(SubsciptionService service, double accountId)
        {
            TypedObject body = WrapBody(new TypedObject(), "messagingDestination", 0);

            body.type = "flex.messaging.messages.CommandMessage";
            TypedObject headers = body.GetTO("headers");

            switch (service)
            {
            case SubsciptionService.GameService:
                headers.Add("DSSubtopic", "gn-" + accountID);
                body["clientId"] = "gn-" + accountID;
                break;

            case SubsciptionService.ClientService:
                headers.Add("DSSubtopic", "cn-" + accountID);
                body["clientId"] = "cn-" + accountID;
                break;

            case SubsciptionService.BroadcastService:
                headers.Add("DSSubtopic", "bc");
                body["clientId"] = "bc-" + accountID;
                break;
            }


            headers.Remove("DSRequestTimeout");

            int Id = Invoke(body);

            while (!results.ContainsKey(Id))
            {
                await Task.Delay(10);
            }

            TypedObject result = GetResult(Id); // Read result and discard

            return(null);
        }