CSharpRTMP.Core.Protocols.Rtmp.SO.RegisterProtocol C# (CSharp) Method

RegisterProtocol() public method

public RegisterProtocol ( BaseProtocol protocol ) : void
protocol BaseProtocol
return void
        public void RegisterProtocol(BaseProtocol protocol)
        {
            _dirtyPropsByProtocol[protocol] = new List<DirtyInfo>();
            //不向主服务器发送初始化SO信息
            if (protocol is OutboundClusterProtocol) return;
            DirtyInfo di;
            	//1. Clear
            di.PropertyName = "SOT_SC_CLEAR_DAT" + protocol.Id;
            di.Type = Defines.SOT_SC_CLEAR_DATA;
            _dirtyPropsByProtocol[protocol].Add(di);
            	//2. Initial
            di.PropertyName = "SOT_SC_INITIAL_DAT" + protocol.Id;
            di.Type = Defines.SOT_SC_INITIAL_DATA;
            _dirtyPropsByProtocol[protocol].Add(di);
                //3. Mark all properties as updated
            if(Payload.Count>0)
                _dirtyPropsByProtocol[protocol].AddRange(Payload.Children.Select(x => new DirtyInfo { PropertyName = x.Key, Type = Defines.SOT_SC_UPDATE_DATA }));
            //foreach (var key in Payload.Children.Keys)
            //{
            //    di.PropertyName = key;
            //    di.Type = Defines.SOT_SC_UPDATE_DATA;
            //    _dirtyPropsByProtocol[protocolId].Add(di);
            //}
        }

Usage Example

 public override void OnSOCreated(SO so)
 {
     foreach (var inboundClusterProtocol in InboundClusters)
     {
         so.RegisterProtocol(inboundClusterProtocol);
     }
 }
All Usage Examples Of CSharpRTMP.Core.Protocols.Rtmp.SO::RegisterProtocol