예제 #1
0
 /// <summary>
 /// Sends a subscribe event through the mesh.
 /// </summary>
 /// <param name="subscription"></param>
 /// <param name="peer">The node to notify.</param>
 public static void NotifySubscribe(this Subscription subscription, MeshMember peer)
 {
     // Send it as a command
     peer.Send(
         MeshEmitterEvent.Acquire(MeshEventType.Subscribe, subscription.ContractKey, subscription.Channel)
         );
 }
예제 #2
0
 /// <summary>
 /// Sends an unsubscribe event through the mesh.
 /// </summary>
 /// <param name="subscription"></param>
 public static void BroadcastUnsubscribe(this Subscription subscription, IMqttSender client)
 {
     // Broadcast to peers
     foreach (var peer in Service.Mesh.Members)
     {
         // Send it as a command
         peer.Send(
             MeshEmitterEvent.Acquire(MeshEventType.Unsubscribe, subscription.ContractKey, subscription.Channel)
             );
     }
 }