Exemple #1
0
 public Variant _Broadcast(BaseProtocol pFrom, Variant invoke)
 {
     var message = Variant.Get();
     message[Defines.RM_INVOKE_FUNCTION] = (string)invoke[1];
     var param = invoke.Clone();
     param.RemoveAt(0);
     param.RemoveAt(0);
     message[Defines.RM_INVOKE_PARAMS] = param;
     Broadcast(pFrom,message);
     return null;
 }
Exemple #2
0
 public Variant _CallClient(BaseProtocol pFrom, Variant invoke)
 {
     string clientId = invoke[1];
     string functionName = invoke[2];
     if (OnlineClient.ContainsKey(clientId))
     {
         invoke.RemoveAt(1);
         invoke.RemoveAt(1);
         CallClient(OnlineClient[clientId], functionName, invoke);
     }
     else if(!(pFrom is BaseClusterProtocol))
     {
         if (ClientApplicationManager.ClusterApplication != null)
             ClientApplicationManager.ClusterApplication.GetProtocolHandler<BaseClusterAppProtocolHandler>().CallAppFunction(Id, "_CallClient", invoke);
     }
     return null;
 }
        public static bool SignalProtocolCreated(BaseProtocol protocol, Variant customParameters)
        {
            var application = ClientApplicationManager.FindAppByName(customParameters[Defines.CONF_APPLICATION_NAME]);

            if (application == null)
            {
                Logger.FATAL("Application {0} not found", customParameters[Defines.CONF_APPLICATION_NAME]);
                return false;
            }
            if (protocol == null)
            {
                Logger.WARN("OutboundCluster Connection failed:{0}", customParameters.ToString());

                application.GetProtocolHandler<SlaveClusterAppProtocolHandler>().ReconnectTimer.Start();
                return false;
            }
            protocol.CustomParameters = customParameters;
            protocol.Application = application;
            return true;
        }
Exemple #4
0
 public override bool OnConnect(BaseProtocol pFrom, Variant param)
 {
     string clientId = param[1];
     var so = SOManager["userList"];
     lock (so)
     {
         if (so.HasProperty(clientId) && OnlineClient.ContainsKey(clientId)) Disconnect(OnlineClient[clientId]);
         so.Set(clientId, Variant.GetMap(new VariantMapHelper
     {
         {"id",clientId},
         {"name",(string)param[2]},
         {"hasCamera",(bool)param[3]},
         {"hasMic",(bool)param[4]},
         {"role",(int)param[5]},
         {"handUp",false}
     }));
         OnlineClient[clientId] = pFrom;
     }
     
     if ((int)param[5] == 1)
     {
         
         so = SOManager["room"];
         lock (so)
         {
             so.Set("adminId", clientId);
         //    so.Set("publisher1", Variant.GetMap(new VariantMapHelper
         //{
         //    {"id",clientId},
         //    {"name",(string)param[2]},
         //}));
         }
        
     }
     return true;
 }
Exemple #5
0
 public Application(Variant configuration)
     : base(configuration)
 {
     
 }
 public static bool GetAuthorizationHeader(string s, string s1, string s2, string requestHeader, string requestHeader1, Variant variant)
 {
     throw new System.NotImplementedException();
 }
 public static bool ValidateAuthRequest(string rawChallange, string rawResponse,
 string method, string requestUri, Variant realm)
 {
     throw new System.NotImplementedException();
 }
 private void FlowStream_OnStatus(CSharpRTMP.Common.Variant obj)
 {
     (Handler as IDownload).Log += obj[1]["code"];
     //Logger.Debug("{0}",obj.ToString());
 }