public void Subscribe(string subject, string filter) { PollingDuplexHttpSecurityMode securitymode = (m_serverURL.StartsWith("https")) ? PollingDuplexHttpSecurityMode.Transport : PollingDuplexHttpSecurityMode.None; SIPSorcerySecurityHeader securityHeader = new SIPSorcerySecurityHeader(m_authID); PullNotificationHeader notificationsHeader = new PullNotificationHeader(m_address.ToString()); SIPSorceryCustomHeader sipSorceryHeader = new SIPSorceryCustomHeader(new List <MessageHeader>() { securityHeader, notificationsHeader }); PollingDuplexCustomHeaderBinding notifierBinding = new PollingDuplexCustomHeaderBinding(sipSorceryHeader, securitymode) { UseTextEncoding = true }; m_client = new PubSubClient(notifierBinding, new EndpointAddress(new Uri(m_serverURL))); m_client.InnerChannel.Faulted += ChannelFaulted; m_client.InnerChannel.Closed += ChannelClosed; m_client.NotifyReceived += NotifyReceived; m_client.CloseSessionReceived += CloseSessionReceived; //DebugMessage_External("Polling Duplex client created, sessionID=" + m_client.InnerChannel.SessionId + ", timeout=" + m_client.InnerChannel.OperationTimeout.TotalSeconds + "s."); m_subject = subject; m_filter = filter; m_client.SubscribeAsync(m_subject, m_filter); }
public PollingDuplexCustomHeaderBinding(IClientCustomHeader customHeader, PollingDuplexHttpSecurityMode securityMode) : base(securityMode) { channelBindingElement = new CustomHeaderBindingElement(); channelBindingElement.CustomHeader = customHeader; }