Esempio n. 1
0
        private void HandleOnPublish(IWampConnection connection, PublishMessage msg)
        {
            if (!_subscriptions.ContainsKey(msg.TopicUri))
            {
                return;
            }

            var subscriptions = new HashSet <IWampServerConnection>(msg.Eligible == null
                    ? _subscriptions[msg.TopicUri]
                    : _subscriptions[msg.TopicUri].Where(x => msg.Eligible.Contains(x.WebSocketConnectionInfo.Id)));

            if (msg.ExcludeMe.HasValue)
            {
                subscriptions.RemoveWhere(x => x.WebSocketConnectionInfo.Id == connection.WebSocketConnectionInfo.Id);
            }

            if (msg.Exclude != null)
            {
                subscriptions.RemoveWhere(x => msg.Exclude.Contains(x.WebSocketConnectionInfo.Id));
            }

            foreach (var subscription in subscriptions)
            {
                subscription.SendPublish(msg);
            }
        }
Esempio n. 2
0
 public void SendPublish(PublishMessage message)
 {
     _wampConnection.SendPublish(message);
 }
Esempio n. 3
0
 public void SendPublish(PublishMessage message)
 {
     SendMessage(message);
     OnPublish(message);
 }