Class: Faye::Subscription
- Inherits:
-
Object
- Object
- Faye::Subscription
- Includes:
- EventMachine::Deferrable
- Defined in:
- lib/faye/protocol/subscription.rb
Instance Method Summary collapse
- #cancel ⇒ Object
-
#initialize(client, channels, callback) ⇒ Subscription
constructor
A new instance of Subscription.
- #unsubscribe ⇒ Object
Constructor Details
#initialize(client, channels, callback) ⇒ Subscription
Returns a new instance of Subscription.
5 6 7 8 9 10 |
# File 'lib/faye/protocol/subscription.rb', line 5 def initialize(client, channels, callback) @client = client @channels = channels @callback = callback @cancelled = false end |
Instance Method Details
#cancel ⇒ Object
12 13 14 15 16 |
# File 'lib/faye/protocol/subscription.rb', line 12 def cancel return if @cancelled @client.unsubscribe(@channels, &@callback) @cancelled = true end |
#unsubscribe ⇒ Object
18 19 20 |
# File 'lib/faye/protocol/subscription.rb', line 18 def unsubscribe cancel end |