Method: Vines::Cluster::PubSub#subscribe

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

#subscribe(domain, node, jid) ⇒ Object

Subscribe the JID to the pubsub topic so it will receive any messages published to it.



36
37
38
39
40
41
42
# File 'lib/vines/cluster/pubsub.rb', line 36

def subscribe(domain, node, jid)
  jid = JID.new(jid)
  redis.multi
  redis.sadd("pubsub:#{domain}:subscribers_#{node}", jid.to_s)
  redis.sadd("pubsub:#{domain}:subscriptions_#{jid}", node)
  redis.exec
end