Publish
extends Endpoint
in package
Table of Contents
Constants
- GET_PATH = "/publish/%s/%s/0/%s/%s/%s"
- POST_PATH = "/publish/%s/%s/0/%s/%s"
- RESPONSE_IS_JSON = true
Properties
- $cachedTransports : array<string|int, mixed>
- $channel : string
- $customHost : mixed
- $envelope : PNEnvelope
- $followRedirects : mixed
- $message : mixed
- $meta : array<string|int, mixed>
- $pubnub : PubNub
- $replicate : bool
- $serialize : bool
- $shouldStore : bool
- $ttl : int
- $usePost : bool
Methods
- __construct() : mixed
- channel() : $this
- clear() : mixed
- Clear cached envelope
- doNotSerialize() : $this
- envelope() : PNEnvelope
- Returns an Envelope that contains both result and status.
- message() : $this
- meta() : $this
- replicate() : $this
- shouldStore() : $this
- sync() : PNPublishResult
- Return a Result only.
- ttl() : $this
- usePost() : $this
- buildData() : string
- buildParams() : array<string|int, mixed>
- Params build flow: signed <- custom <- default
- buildPath() : string
- createResponse() : PNPublishResult
- customHeaders() : mixed
- customParams() : array<string|int, mixed>
- defaultHeaders() : mixed
- defaultParams() : array<string|int, mixed>
- fetchPayload() : array<string|int, mixed>
- getAffectedChannelGroups() : mixed
- getAffectedChannels() : mixed
- getAffectedUsers() : mixed
- getConnectTimeout() : int
- getName() : string
- getOperationType() : int
- getRequestTimeout() : int
- getTransport() : mixed
- httpMethod() : string
- invokeRequest() : PNEnvelope
- invokeRequestAndCacheIt() : PNEnvelope
- isAuthRequired() : bool
- requestOptions() : array<string|int, mixed>
- validateChannelGroups() : mixed
- validateParams() : mixed
- validatePublishKey() : mixed
- validateSecretKey() : mixed
- validateSubscribeKey() : mixed
- createStatus() : PNStatus
- getDefaultTransport() : Transport
Constants
GET_PATH
public
mixed
GET_PATH
= "/publish/%s/%s/0/%s/%s/%s"
POST_PATH
public
mixed
POST_PATH
= "/publish/%s/%s/0/%s/%s"
RESPONSE_IS_JSON
protected
mixed
RESPONSE_IS_JSON
= true
Properties
$cachedTransports
protected
static array<string|int, mixed>
$cachedTransports
= []
$channel
protected
string
$channel
to send message on
$customHost
protected
mixed
$customHost
= null
$envelope
protected
PNEnvelope
$envelope
$followRedirects
protected
mixed
$followRedirects
= true
$message
protected
mixed
$message
to publish
$meta
protected
array<string|int, mixed>
$meta
data
$pubnub
protected
PubNub
$pubnub
$replicate
protected
bool
$replicate
= true
$serialize
protected
bool
$serialize
= true
$shouldStore
protected
bool
$shouldStore
in history
$ttl
protected
int
$ttl
in storage (min ?)
$usePost
protected
bool
$usePost
HTTP method instead of default GET
Methods
__construct()
public
__construct(PubNub $pubnubInstance) : mixed
Parameters
- $pubnubInstance : PubNub
channel()
public
channel(string $channel) : $this
Parameters
- $channel : string
Return values
$thisclear()
Clear cached envelope
public
clear() : mixed
doNotSerialize()
public
doNotSerialize() : $this
Return values
$thisenvelope()
Returns an Envelope that contains both result and status.
public
envelope() : PNEnvelope
All Errors are wrapped, so no need to use try/catch blocks
Return values
PNEnvelopemessage()
public
message(mixed $message) : $this
Parameters
- $message : mixed
Return values
$thismeta()
public
meta(array<string|int, mixed> $meta) : $this
Parameters
- $meta : array<string|int, mixed>
Return values
$thisreplicate()
public
replicate(bool $replicate) : $this
Parameters
- $replicate : bool
Return values
$thisshouldStore()
public
shouldStore(bool $shouldStore) : $this
Parameters
- $shouldStore : bool
Return values
$thissync()
Return a Result only.
public
sync() : PNPublishResult
Return values
PNPublishResultttl()
public
ttl(int $ttl) : $this
Parameters
- $ttl : int
Return values
$thisusePost()
public
usePost(bool $usePost) : $this
Parameters
- $usePost : bool
Return values
$thisbuildData()
protected
buildData() : string
Tags
Return values
stringbuildParams()
Params build flow: signed <- custom <- default
protected
buildParams() : array<string|int, mixed>
Return values
array<string|int, mixed>buildPath()
protected
buildPath() : string
Tags
Return values
stringcreateResponse()
protected
createResponse(array<string|int, mixed> $result) : PNPublishResult
Parameters
- $result : array<string|int, mixed>
-
Decoded json
Return values
PNPublishResultcustomHeaders()
protected
customHeaders() : mixed
customParams()
protected
customParams() : array<string|int, mixed>
Return values
array<string|int, mixed>defaultHeaders()
protected
defaultHeaders() : mixed
defaultParams()
protected
defaultParams() : array<string|int, mixed>
Return values
array<string|int, mixed>fetchPayload()
protected
static fetchPayload(mixed $json) : array<string|int, mixed>
Parameters
- $json : mixed
Tags
Return values
array<string|int, mixed>getAffectedChannelGroups()
protected
getAffectedChannelGroups() : mixed
getAffectedChannels()
protected
getAffectedChannels() : mixed
getAffectedUsers()
protected
getAffectedUsers() : mixed
getConnectTimeout()
protected
getConnectTimeout() : int
Return values
intgetName()
protected
getName() : string
Return values
stringgetOperationType()
protected
getOperationType() : int
Return values
intgetRequestTimeout()
protected
getRequestTimeout() : int
Return values
intgetTransport()
protected
getTransport() : mixed
httpMethod()
protected
httpMethod() : string
Return values
stringinvokeRequest()
protected
invokeRequest() : PNEnvelope
Return values
PNEnvelopeinvokeRequestAndCacheIt()
protected
invokeRequestAndCacheIt() : PNEnvelope
Tags
Return values
PNEnvelopeisAuthRequired()
protected
isAuthRequired() : bool
Return values
boolrequestOptions()
protected
requestOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>validateChannelGroups()
protected
validateChannelGroups(array<string|int, string>|string $channels, array<string|int, string>|string $groups) : mixed
Parameters
- $channels : array<string|int, string>|string
- $groups : array<string|int, string>|string
Tags
validateParams()
protected
validateParams() : mixed
Tags
validatePublishKey()
protected
validatePublishKey() : mixed
Tags
validateSecretKey()
protected
validateSecretKey() : mixed
Tags
validateSubscribeKey()
protected
validateSubscribeKey() : mixed
Tags
createStatus()
private
createStatus(int $category, mixed $response, ResponseInfo|null $responseInfo, PubNubException|null $exception) : PNStatus
Parameters
- $category : int
- $response : mixed
- $responseInfo : ResponseInfo|null
- $exception : PubNubException|null
Return values
PNStatusgetDefaultTransport()
private
getDefaultTransport() : Transport