Beispiel #1
0
        public byte[] EncodeConnect(Dictionary <string, object> paramaters)
        {
            List <byte> list = new List <byte>();

            this.WriteStringAMF0(list, "connect");
            this.WriteIntAMF0(list, 1);
            list.Add(17);
            list.Add(9);
            this.WriteAssociativeArray(list, paramaters);
            list.Add(1);
            list.Add(0);
            this.WriteStringAMF0(list, "nil");
            this.WriteStringAMF0(list, "");
            TypedObject typedObject = new TypedObject("flex.messaging.messages.CommandMessage");

            typedObject.Add("operation", 5);
            typedObject.Add("correlationId", "");
            typedObject.Add("timestamp", 0);
            typedObject.Add("messageId", RTMPSEncoder.RandomUID());
            typedObject.Add("body", new TypedObject(null));
            typedObject.Add("destination", "");
            typedObject.Add("headers", new Dictionary <string, object>
            {
                {
                    "DSMessagingVersion",
                    1.0
                },
                {
                    "DSId",
                    "my-rtmps"
                }
            });
            typedObject.Add("clientId", null);
            typedObject.Add("timeToLive", 0);
            list.Add(17);
            this.Encode(list, typedObject);
            byte[] array = new byte[list.Count];
            for (int i = 0; i < array.Length; i++)
            {
                array[i] = list[i];
            }
            array    = this.AddHeaders(array);
            array[7] = 20;
            return(array);
        }
Beispiel #2
0
        protected TypedObject WrapBody(object body, string destination, object operation)
        {
            TypedObject headers = new TypedObject();
            headers.Add("DSRequestTimeout", 60);
            headers.Add("DSId", DSId);
            headers.Add("DSEndpoint", "my-rtmps");

            TypedObject ret = new TypedObject("flex.messaging.messages.RemotingMessage");
            ret.Add("operation", operation);
            ret.Add("source", null);
            ret.Add("timestamp", 0);
            ret.Add("messageId", RTMPSEncoder.RandomUID());
            ret.Add("timeToLive", 0);
            ret.Add("clientId", null);
            ret.Add("destination", destination);
            ret.Add("body", body);
            ret.Add("headers", headers);

            return ret;
        }