コード例 #1
0
 ///<summary>
 /// Notification that a new client session has been opened.
 /// When the listener is registered, this will be called for all existing sessions. It will then be called
 /// for every new session that opens whilst the listener is registered.
 /// This will be called for every client session regardless of requested session properties.
 /// </summary>
 /// <param name="sessionId">The session identifier.</param><param name="properties">The map of requested
 /// session property values. This can be empty if no properties were requested. If a requested property did
 /// not exist then it will not be prsent in the map.</param>
 public override void OnSessionOpen(SessionId sessionId, IDictionary <string, string> properties)
 {
     if ("Accounts".Equals(properties["Department"]) && "IT".Equals(properties["$Country"]))
     {
         _subscriptionControl.Subscribe(sessionId, _currentTopic, _subscriptionCallback);
     }
 }
コード例 #2
0
 /// <summary>
 /// Subscribe a client to topics.
 /// </summary>
 /// <param name="sessionId">The session id of the client to subscribe.</param>
 /// <param name="topicSelector">The topic selector expression.</param>
 /// <param name="callback">The callback for the subscription result.</param>
 public void Subscribe(SessionId sessionId, string topicSelector, ISubscriptionCallback callback)
 {
     // To subscribe a client to a topic, this client session must have the MODIFY_SESSION permission.
     subscriptionControl.Subscribe(sessionId, topicSelector, callback);
 }