Skip to content

Instantly share code, notes, and snippets.

@SahSantoshh
Last active May 23, 2020 11:24
Show Gist options
  • Save SahSantoshh/cb7891cb2e55bda7d2e99a8f43662581 to your computer and use it in GitHub Desktop.
Save SahSantoshh/cb7891cb2e55bda7d2e99a8f43662581 to your computer and use it in GitHub Desktop.
def subscribe
EM.run do
# Subscribe to the account PushTopic.
account_topic = ENV['ACCOUNT_PUSH_TOPIC_NAME']
contact_topic = ENV['CONTACT_PUSH_TOPIC_NAME']
@client.subscription "/topic/#{account_topic}" do |message|
Logger.new(LOG_PATH).info('Account Received')
message.inspect
end
# Subscribe to the contact PushTopic.
@client.subscription "/topic/#{contact_topic}" do |message|
Logger.new(LOG_PATH).info('Contact Received')
message.inspect
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment