PubnubSubscription
extends SubscriptionBase
in package
The EventDispatcherInterface is the central point of Symfony's event listener system.
Listeners are registered on the manager and events are dispatched through the manager.
Table of Contents
Constants
- EVENT_NOTIFICATION = 'notification'
- EVENT_REMOVE_ERROR = 'removeError'
- EVENT_REMOVE_SUCCESS = 'removeSuccess'
- EVENT_RENEW_ERROR = 'renewError'
- EVENT_RENEW_SUCCESS = 'renewSuccess'
- EVENT_SUBSCRIBE_ERROR = 'subscribeError'
- EVENT_SUBSCRIBE_SUCCESS = 'subscribeSuccess'
- EVENT_TIMEOUT = 'timeout'
- RENEW_HANDICAP = 120
- SUBSCRIBE_TIMEOUT = 60
Properties
- $_eventFilters : array<string|int, string>
- $_keepPolling : mixed
- $_platform : Platform
- $_pubnub : Pubnub
- $_skipSubscribe : mixed
- $_subscription : array<string|int, mixed>
- $listeners : mixed
- $optimized : mixed
- $sorted : mixed
Methods
- __construct() : mixed
- addEvents() : $this
- addListener() : mixed
- Adds an event listener that listens on the specified events.
- addSubscriber() : mixed
- Adds an event subscriber.
- alive() : bool
- dispatch() : object
- Dispatches an event to all registered listeners.
- expirationTime() : int
- getListenerPriority() : int|null
- Gets the listener priority for a specific event.
- getListeners() : array<string|int, mixed>
- Gets the listeners of a specific event or all listeners sorted by descending priority.
- hasListeners() : bool
- Checks whether an event has any registered listeners.
- keepPolling() : bool
- notify() : bool
- Attention, this function is NOT PUBLIC!!! The only reason it's public is due to PHP 5.3 limitations
- pubnub() : Pubnub
- pubnubTimeoutHandler() : mixed
- Attention, this function is NOT PUBLIC!!! The only reason it's public is due to PHP 5.3 limitations
- register() : ApiResponse|$this
- remove() : ApiResponse
- removeListener() : mixed
- Removes an event listener from the specified events.
- removeSubscriber() : mixed
- renew() : $this
- reset() : mixed
- setEvents() : $this
- setKeepPolling() : void
- setSkipSubscribe() : void
- setSubscription() : $this
- skipSubscribe() : bool
- subscribe() : ApiResponse
- subscribed() : bool
- subscription() : array<string|int, mixed>
- callListeners() : mixed
- Triggers the listeners of an event.
- decrypt() : bool|mixed|string
- doDispatch() : mixed
- getFullEventFilters() : array<string|int, mixed>
- subscribeAtPubnub() : $this
- optimizeListeners() : array<string|int, mixed>
- Optimizes the internal list of listeners for the given event by priority.
- sortListeners() : mixed
- Sorts the internal list of listeners for the given event by priority.
Constants
EVENT_NOTIFICATION
public
mixed
EVENT_NOTIFICATION
= 'notification'
EVENT_REMOVE_ERROR
public
mixed
EVENT_REMOVE_ERROR
= 'removeError'
EVENT_REMOVE_SUCCESS
public
mixed
EVENT_REMOVE_SUCCESS
= 'removeSuccess'
EVENT_RENEW_ERROR
public
mixed
EVENT_RENEW_ERROR
= 'renewError'
EVENT_RENEW_SUCCESS
public
mixed
EVENT_RENEW_SUCCESS
= 'renewSuccess'
EVENT_SUBSCRIBE_ERROR
public
mixed
EVENT_SUBSCRIBE_ERROR
= 'subscribeError'
EVENT_SUBSCRIBE_SUCCESS
public
mixed
EVENT_SUBSCRIBE_SUCCESS
= 'subscribeSuccess'
EVENT_TIMEOUT
public
mixed
EVENT_TIMEOUT
= 'timeout'
RENEW_HANDICAP
public
mixed
RENEW_HANDICAP
= 120
SUBSCRIBE_TIMEOUT
public
mixed
SUBSCRIBE_TIMEOUT
= 60
Properties
$_eventFilters
protected
array<string|int, string>
$_eventFilters
= []
$_keepPolling
protected
mixed
$_keepPolling
= false
$_platform
protected
Platform
$_platform
$_pubnub
protected
Pubnub
$_pubnub
$_skipSubscribe
protected
mixed
$_skipSubscribe
= false
$_subscription
protected
array<string|int, mixed>
$_subscription
= [
'eventFilters' => [],
'expirationTime' => '',
// 2014-03-12T19:54:35.613Z
'expiresIn' => 0,
'deliveryMode' => ['transportType' => 'PubNub', 'encryption' => false, 'address' => '', 'subscriberKey' => '', 'secretKey' => ''],
'id' => '',
'creationTime' => '',
// 2014-03-12T19:54:35.613Z
'status' => '',
// Active
'uri' => '',
]
$listeners
private
mixed
$listeners
= []
$optimized
private
mixed
$optimized
$sorted
private
mixed
$sorted
= []
Methods
__construct()
public
__construct(Platform $platform) : mixed
Parameters
- $platform : Platform
addEvents()
public
addEvents(array<string|int, mixed> $events) : $this
Parameters
- $events : array<string|int, mixed>
Return values
$thisaddListener()
Adds an event listener that listens on the specified events.
public
addListener(mixed $eventName, mixed $listener[, mixed $priority = 0 ]) : mixed
Parameters
- $eventName : mixed
-
The event to listen on
- $listener : mixed
-
The listener
- $priority : mixed = 0
-
The higher this value, the earlier an event listener will be triggered in the chain (defaults to 0)
addSubscriber()
Adds an event subscriber.
public
addSubscriber(EventSubscriberInterface $subscriber) : mixed
Parameters
- $subscriber : EventSubscriberInterface
alive()
public
alive() : bool
Return values
booldispatch()
Dispatches an event to all registered listeners.
public
dispatch(mixed $event) : object
Parameters
- $event : mixed
-
The event to pass to the event handlers/listeners
Return values
object —The passed $event MUST be returned
expirationTime()
public
expirationTime() : int
Return values
intgetListenerPriority()
Gets the listener priority for a specific event.
public
getListenerPriority(mixed $eventName, mixed $listener) : int|null
Parameters
- $eventName : mixed
-
The name of the event
- $listener : mixed
-
The listener
Return values
int|null —The event listener priority
getListeners()
Gets the listeners of a specific event or all listeners sorted by descending priority.
public
getListeners([mixed $eventName = null ]) : array<string|int, mixed>
Parameters
- $eventName : mixed = null
-
The name of the event
Return values
array<string|int, mixed> —The event listeners for the specified event, or all event listeners by event name
hasListeners()
Checks whether an event has any registered listeners.
public
hasListeners([mixed $eventName = null ]) : bool
Parameters
- $eventName : mixed = null
-
The name of the event
Return values
bool —true if the specified event has any listeners, false otherwise
keepPolling()
public
keepPolling() : bool
Return values
boolnotify()
Attention, this function is NOT PUBLIC!!! The only reason it's public is due to PHP 5.3 limitations
public
notify(PNMessageResult $pubnubMessage) : bool
Parameters
- $pubnubMessage : PNMessageResult
Tags
Return values
boolpubnub()
public
pubnub() : Pubnub
Return values
PubnubpubnubTimeoutHandler()
Attention, this function is NOT PUBLIC!!! The only reason it's public is due to PHP 5.3 limitations
public
pubnubTimeoutHandler() : mixed
Tags
register()
public
register([array<string|int, mixed> $options = [] ]) : ApiResponse|$this
Parameters
- $options : array<string|int, mixed> = []
Tags
Return values
ApiResponse|$thisremove()
public
remove() : ApiResponse
Tags
Return values
ApiResponseremoveListener()
Removes an event listener from the specified events.
public
removeListener(mixed $eventName, mixed $listener) : mixed
Parameters
- $eventName : mixed
-
The event to remove a listener from
- $listener : mixed
-
The listener to remove
removeSubscriber()
public
removeSubscriber(EventSubscriberInterface $subscriber) : mixed
Parameters
- $subscriber : EventSubscriberInterface
renew()
public
renew([array<string|int, mixed> $options = [] ]) : $this
Parameters
- $options : array<string|int, mixed> = []
Tags
Return values
$thisreset()
public
reset() : mixed
setEvents()
public
setEvents(array<string|int, mixed> $events) : $this
Parameters
- $events : array<string|int, mixed>
Return values
$thissetKeepPolling()
public
setKeepPolling([bool $flag = false ]) : void
Parameters
- $flag : bool = false
setSkipSubscribe()
public
setSkipSubscribe([bool $flag = false ]) : void
Parameters
- $flag : bool = false
setSubscription()
public
setSubscription(array<string|int, mixed> $subscription) : $this
Parameters
- $subscription : array<string|int, mixed>
Return values
$thisskipSubscribe()
public
skipSubscribe() : bool
Return values
boolsubscribe()
public
subscribe([array<string|int, mixed> $options = [] ]) : ApiResponse
Parameters
- $options : array<string|int, mixed> = []
Tags
Return values
ApiResponsesubscribed()
public
subscribed() : bool
Return values
boolsubscription()
public
subscription() : array<string|int, mixed>
Return values
array<string|int, mixed>callListeners()
Triggers the listeners of an event.
protected
callListeners(array<string|int, callable> $listeners, string $eventName, object $event) : mixed
This method can be overridden to add functionality that is executed for each listener.
Parameters
- $listeners : array<string|int, callable>
-
The event listeners
- $eventName : string
-
The name of the event to dispatch
- $event : object
-
The event object to pass to the event handlers/listeners
decrypt()
protected
decrypt(mixed $message) : bool|mixed|string
Parameters
- $message : mixed
Tags
Return values
bool|mixed|stringdoDispatch()
protected
doDispatch(mixed $listeners, mixed $eventName, Event $event) : mixed
since Symfony 4.3, use callListeners() instead
Parameters
- $listeners : mixed
- $eventName : mixed
- $event : Event
getFullEventFilters()
protected
getFullEventFilters() : array<string|int, mixed>
Return values
array<string|int, mixed>subscribeAtPubnub()
protected
subscribeAtPubnub() : $this
Tags
Return values
$thisoptimizeListeners()
Optimizes the internal list of listeners for the given event by priority.
private
optimizeListeners(string $eventName) : array<string|int, mixed>
Parameters
- $eventName : string
Return values
array<string|int, mixed>sortListeners()
Sorts the internal list of listeners for the given event by priority.
private
sortListeners(string $eventName) : mixed
Parameters
- $eventName : string