Skip to content

Instantly share code, notes, and snippets.

@jnevelson
Last active December 10, 2015 19:08
Show Gist options
  • Save jnevelson/4479279 to your computer and use it in GitHub Desktop.
Save jnevelson/4479279 to your computer and use it in GitHub Desktop.
pubnub listener
class PubnubListener
def initialize(pubkey, subkey, secretkey)
@pubnub = Pubnub.new(pubkey, subkey, secretkey, false)
end
def listen(channel)
@pubnub.subscribe('channel' => channel, 'callback' => lambda { |msg| puts msg })
end
def publish(channel, message)
@pubnub.publish('channel' => channel, 'message' => message)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment