Module: Pubnub::Client::Connections

Included in:
Pubnub::Client
Defined in:
lib/pubnub/client/connections.rb

Overview

Module that holds methods that helps us with connections management. Must be plugged into Client class, uses @env

Instance Method Summary (collapse)

Instance Method Details

- (Object) setup_conn_for(event)



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/pubnub/client/connections.rb', line 8

def setup_conn_for(event)
  if event.is_a? SingleEvent
    setup_conn_for_single_event(event)
  elsif event.is_a? SubscribeEvent
    setup_conn_for_subscribe_event(event)
  end
  begin
    @env[:connection_callback].call 'Connected!' if @env[:connection_callback]
  rescue => error
    Pubnub.logger.error('Pubnub::Client') do
      "Error while calling connection callback #{error.inspect}"
    end
  end
end