RTM Subscription model.
package |
Default |
---|
__construct(string $subscription_id, callable $callback, array $options = array())
When you create a channel subscription, you can specify additional properties, for example, add a filter to the subscription and specify the behavior of the SDK when resubscribing after a reconnection.
For more information about the options for a channel subscription, see Subscribe PDU in the online docs
string
String that identifies the channel. If you do not use the filter parameter, it is the channel name. Otherwise, it is a unique identifier for the channel (subscription id).
callable
Custom callback. Such callback will be called on any subscription events, described in {@see RtmClient\Subscription\Events} Callback function will get 3 arguments: $ctx - Context. Current subscription instance $type - Event type: {@see RtmClient\Subscription\Events} $data - Type-related data. Check Protocol Data Unit (PDU) to get information about data content
array
Subscription options. Additional subscription options for a channel subscription. These options are sent to RTM in the body element of the Protocol Data Unit (PDU) that represents the subscribe request.
For more information about the *body* element of a PDU,
see *RTM API* in the online docs
callback(string $type, array $data = null) : void
string
Events::[NAME]
array
Data to be passed to user callback
getCallback() : callable
callable
User callback
getOptions() : array
array
Options
getPosition() : integer
integer
Position
getSubscriptionId() : mixed
mixed
Subscription ID
markUnsubscribe(array $body = array()) : void
array
onPdu(\RtmClient\Pdu\Pdu $pdu) : true
processDisconnect() : void
processSubscribeError(array $body) : void
array
processSubscribeOk(array $body) : void
array
processSubscriptionData(array $body) : void
array
processSubscriptionError(array $body) : void
array
processSubscriptionInfo(array $body) : void
array
processUnsubscribeError(array $body) : void
array
processUnsubscribeOk(array $body) : void
array
setContext(string $key, mixed $context)
Context is passed to subscription callback.
string
Context key
mixed
Context value
setLogger(\Psr\Log\LoggerInterface $logger) : void
\Psr\Log\LoggerInterface
Custom logger
subscribePdu() : \RtmClient\Pdu\Pdu
trackPosition(array $body) : void
array
unsubscribePdu() : \RtmClient\Pdu\Pdu
subscription_id : string
var |
---|
string
position : string
var |
---|
string
body : array
var |
---|
array