Class: Pubnub::Event
Overview
Event module holds most basic and required infrastructure for every pubnub event, there are also SingleEvent module and SubscribeEvent module
Direct Known Subclasses
Instance Attribute Summary (collapse)
-
- (Object) callback
readonly
Returns the value of attribute callback.
-
- (Object) channel
(also: #channels)
readonly
Returns the value of attribute channel.
-
- (Object) error_callback
readonly
Returns the value of attribute error_callback.
-
- (Object) group
readonly
Returns the value of attribute group.
-
- (Object) idle_timeout
readonly
Returns the value of attribute idle_timeout.
-
- (Object) open_timeout
readonly
Returns the value of attribute open_timeout.
-
- (Object) origin
readonly
Returns the value of attribute origin.
-
- (Object) presence_callback
readonly
Returns the value of attribute presence_callback.
-
- (Object) read_timeout
readonly
Returns the value of attribute read_timeout.
Instance Method Summary (collapse)
- - (Boolean) finalized?
- - (Object) fire
-
- (Event) initialize(options, app)
constructor
A new instance of Event.
- - (Boolean) sync?
- - (Object) uri
Constructor Details
- (Event) initialize(options, app)
Returns a new instance of Event
12 13 14 15 16 17 18 19 20 |
# File 'lib/pubnub/event.rb', line 12 def initialize(, app) @app = app (app.env.merge()) @origin = @app.current_origin format_channels format_group Pubnub.logger.debug('Pubnub::Event') { "Initialized #{self.class}" } end |
Instance Attribute Details
- (Object) callback (readonly)
Returns the value of attribute callback
6 7 8 |
# File 'lib/pubnub/event.rb', line 6 def callback @callback end |
- (Object) channel (readonly) Also known as: channels
Returns the value of attribute channel
6 7 8 |
# File 'lib/pubnub/event.rb', line 6 def channel @channel end |
- (Object) error_callback (readonly)
Returns the value of attribute error_callback
6 7 8 |
# File 'lib/pubnub/event.rb', line 6 def error_callback @error_callback end |
- (Object) group (readonly)
Returns the value of attribute group
6 7 8 |
# File 'lib/pubnub/event.rb', line 6 def group @group end |
- (Object) idle_timeout (readonly)
Returns the value of attribute idle_timeout
6 7 8 |
# File 'lib/pubnub/event.rb', line 6 def idle_timeout @idle_timeout end |
- (Object) open_timeout (readonly)
Returns the value of attribute open_timeout
6 7 8 |
# File 'lib/pubnub/event.rb', line 6 def open_timeout @open_timeout end |
- (Object) origin (readonly)
Returns the value of attribute origin
6 7 8 |
# File 'lib/pubnub/event.rb', line 6 def origin @origin end |
- (Object) presence_callback (readonly)
Returns the value of attribute presence_callback
6 7 8 |
# File 'lib/pubnub/event.rb', line 6 def presence_callback @presence_callback end |
- (Object) read_timeout (readonly)
Returns the value of attribute read_timeout
6 7 8 |
# File 'lib/pubnub/event.rb', line 6 def read_timeout @read_timeout end |
Instance Method Details
- (Boolean) finalized?
46 47 48 |
# File 'lib/pubnub/event.rb', line 46 def finalized? @finalized || @stop end |
- (Object) fire
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/pubnub/event.rb', line 22 def fire Pubnub.logger.debug('Pubnub::Event') { "Fired event #{self.class}" } sender = request_dispatcher = sender.send_request(Celluloid::Actor.current) envelopes = fire_callbacks(handle()) finalize_event(envelopes) envelopes ensure sender.terminate if @http_sync terminate unless @stay_alive end |
- (Boolean) sync?
50 51 52 |
# File 'lib/pubnub/event.rb', line 50 def sync? @http_sync ? true : false end |
- (Object) uri
37 38 39 40 41 42 43 44 |
# File 'lib/pubnub/event.rb', line 37 def uri uri = @ssl ? 'https://' : 'http://' uri += @origin uri += path uri += '?' + Formatter.params_hash_to_url_params(parameters) Pubnub.logger.debug('Pubnub::Event') { "Requested URI: #{uri}" } URI uri end |