Class: Slanger::Subscription

Inherits:
Object
  • Object
show all
Defined in:
lib/slanger/subscription.rb

Direct Known Subclasses

PresenceSubscription, PrivateSubscription

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(socket, socket_id, msg) ⇒ Subscription

Returns a new instance of Subscription.



6
7
8
9
# File 'lib/slanger/subscription.rb', line 6

def initialize(socket, socket_id, msg)
  @connection = Connection.new socket, socket_id
  @msg = msg
end

Instance Attribute Details

#connectionObject

Returns the value of attribute connection.



3
4
5
# File 'lib/slanger/subscription.rb', line 3

def connection
  @connection
end

#socketObject

Returns the value of attribute socket.



3
4
5
# File 'lib/slanger/subscription.rb', line 3

def socket
  @socket
end

Instance Method Details

#subscribeObject



11
12
13
14
15
# File 'lib/slanger/subscription.rb', line 11

def subscribe
  send_payload channel_id, "pusher_internal:subscription_succeeded"

  channel.subscribe { |m| send_message m }
end