Method: Vines::Cluster::PubSub#unsubscribe

Defined in:
lib/vines/cluster/pubsub.rb

#unsubscribe(domain, node, jid) ⇒ Object

Unsubscribe the JID from the pubsub topic, deregistering its interest in receiving any messages published to it.



46
47
48
49
50
51
52
53
54
55
# File 'lib/vines/cluster/pubsub.rb', line 46

def unsubscribe(domain, node, jid)
  jid = JID.new(jid)
  redis.multi
  redis.srem("pubsub:#{domain}:subscribers_#{node}", jid.to_s)
  redis.srem("pubsub:#{domain}:subscriptions_#{jid}", node)
  redis.exec
  redis.scard("pubsub:#{domain}:subscribers_#{node}") do |count|
    delete_node(domain, node) if count == 0
  end
end