pixie v0.3.9 Pixie.LocalSubscription

Represents an in-VM subscription to a Bayeux channel.

Summary

Functions

Subscribe to a channel and call the provided function with messages

Cancel a local subscription

Functions

start_link(channel_name, callback)
subscribe(channel_name, callback)

Subscribe to a channel and call the provided function with messages.

{:ok, sub} = Pixie.subscribe "/my_awesome_channel", fn(message,_)->
  IO.inspect message
end

The function must take two arguments:

  • A message struct.
  • The subscription pid.
unsubscribe(pid)

Cancel a local subscription.

Example:

Pixie.subscribe "/only_one_please", fn(message,sub)->
  IO.inspect message
  Pixie.unsubscribe sub
end