예제 #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
        private bool SendConnect()
        {
            Dictionary <string, object> paramaters = new Dictionary <string, object>();

            paramaters.Add("app", "");
            paramaters.Add("flashVer", "WIN 10,6,602,161");
            paramaters.Add("swfUrl", "app:/LolClient.swf/[[DYNAMIC]]/32");
            paramaters.Add("tcUrl", "rtmps://" + server + ":" + 2099);
            paramaters.Add("fpad", false);
            paramaters.Add("capabilities", 239);
            paramaters.Add("audioCodecs", 3575);
            paramaters.Add("videoCodecs", 252);
            paramaters.Add("videoFunction", 1);
            paramaters.Add("pageUrl", null);
            paramaters.Add("objectEncoding", 3);

            RTMPSEncoder encoder = new RTMPSEncoder();

            byte[] connect = encoder.EncodeConnect(paramaters);

            sslStream.Write(connect, 0, connect.Length);

            while (!results.ContainsKey(1))
            {
                Thread.Sleep(10);
            }
            TypedObject result = results[1];

            results.Remove(1);
            if (result["result"].Equals("_error"))
            {
                Error(GetErrorMessage(result), ErrorType.Connect);
                Disconnect();
                return(false);
            }

            DSId = result.GetTO("data").GetString("id");

            isConnected = true;
            if (OnConnect != null)
            {
                OnConnect(this, EventArgs.Empty);
            }

            return(true);
        }
예제 #3
0
        private bool SendConnect()
        {
            Dictionary <string, object> paramaters = new Dictionary <string, object>();

            paramaters.Add("app", "");
            paramaters.Add("flashVer", "WIN 10,6,602,161");
            paramaters.Add("swfUrl", "app:/LolClient.swf/[[DYNAMIC]]/32");
            paramaters.Add("tcUrl", string.Concat(new object[] { "rtmps://", this.server, ":", 0x833 }));
            paramaters.Add("fpad", false);
            paramaters.Add("capabilities", 0xef);
            paramaters.Add("audioCodecs", 0xdf7);
            paramaters.Add("videoCodecs", 0xfc);
            paramaters.Add("videoFunction", 1);
            paramaters.Add("pageUrl", null);
            paramaters.Add("objectEncoding", 3);
            byte[] buffer = new RTMPSEncoder().EncodeConnect(paramaters);
            this.sslStream.Write(buffer, 0, buffer.Length);
            while (!this.results.ContainsKey(1))
            {
                Thread.Sleep(10);
            }
            TypedObject message = this.results[1];

            this.results.Remove(1);
            if (message["result"].Equals("_error"))
            {
                this.Error(this.GetErrorMessage(message), ErrorType.Connect);
                this.Disconnect();
                return(false);
            }
            this.DSId        = message.GetTO("data").GetString("id");
            this.isConnected = true;
            if (this.OnConnect != null)
            {
                this.OnConnect(this, EventArgs.Empty);
            }
            return(true);
        }
예제 #4
0
 private string GetErrorMessage(TypedObject message)
 {
     // Works for clientVersion
     return message.GetTO("data").GetTO("rootCause").GetString("message");
 }
예제 #5
0
 private string GetErrorCode(TypedObject message)
 {
     return message.GetTO("data").GetTO("rootCause").GetString("errorCode");
 }