Esempio n. 1
0
        protected virtual void OnMessageLoad(EndPointMessage message)
        {
            var sender = Instance.DBTable.LoadById(message.SenderName);

            if (sender == null)
            {
                return;
            }
            sender.ReceiveCount++;
            sender.ReceiveLength += message.Lenght;

            switch (message.Type)
            {
            case (SocketMessageType.Hello):
                sender.Active = true;
                break;

            case (SocketMessageType.Login):
                sender.Active = true;
                Send(endPoint.GetBytes(), sender, SocketMessageType.Hello);
                break;

            case (SocketMessageType.Logout):
                sender.Detach();
                break;

            case (SocketMessageType.Data):
                Deserialize(message.Data);
                break;
            }
            MessageLoad?.Invoke(message);
        }
        public CastMessage GetLoadMessage(string streamingUrl, string sourceId, string destinationId)
        {
            var message = new MessageLoad
            {
                type           = "LOAD",
                autoplay       = true,
                currentTime    = 0,
                activeTrackIds = new List <object>(),
                repeatMode     = "REPEAT_OFF",
                media          = new Media
                {
                    contentId   = streamingUrl,
                    contentType = "audio/wav",
                    streamType  = "BUFFERED", // BUFFERED or LIVE
                    metadata    = new Metadata
                    {
                        type         = 0,
                        metadataType = 0,
                        title        = "Desktop Stream",
                        images       = new List <Image>()
                    },
                },
                requestId = 1
            };

            return(GetCastMessage(message, namespaceMedia, sourceId, destinationId));
        }
Esempio n. 3
0
        public void MIMEMessages()
        {
            try
            {
                //MessageLoad<MimeMessage> testMIME_1 =
                //    new MessageLoad<MimeMessage>("Ximura.UnitTest.Communication.MIME.Examples.MimeExample1.mht, XimuraUTCommEntities");

                MessageLoad<MimeMessage> testMIME_2 =
                    new MessageLoad<MimeMessage>("Ximura.UnitTest.Communication.MIME.Examples.MimeExample2.mht, XimuraUTCommMessaging");

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 4
0
        public void HTTPResponseMessages()
        {
            try
            {
                MessageLoad<HTTPResponseMessage> testHTTP_RS1 =
                    new MessageLoad<HTTPResponseMessage>("Ximura.UnitTest.Communication.HTTP.Examples.http1_rs.txt, XimuraUTCommMessaging");

                MessageLoad<HTTPResponseMessage> testHTTP_RS2 =
                    new MessageLoad<HTTPResponseMessage>("Ximura.UnitTest.Communication.HTTP.Examples.http2_rs.txt, XimuraUTCommMessaging");

                MessageLoad<HTTPResponseMessage> testHTTP_RS3 =
                    new MessageLoad<HTTPResponseMessage>("Ximura.UnitTest.Communication.HTTP.Examples.http3_rs.txt, XimuraUTCommMessaging");
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 5
0
 public void HTTPMultipartFormDataRequestParse()
 {
     try
     {
         MessageLoad<HTTPRequestMessage> testHTTP_RQ4 =
             new MessageLoad<HTTPRequestMessage>("Ximura.UnitTest.Communication.HTTP.Examples.httpMime1.txt, XimuraUTCommMessaging");
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }