UnityUnity V4 Publish & Subscribe API Reference for Realtime Apps

Go to Configuration


 

These docs are for PubNub 4.x for Unity which is our latest and greatest! For the docs of the older versions of the SDK, please check PubNub 3.x for Unity.

If you have questions about the PubNub for Unity SDK, please contact us at support@pubnub.com.

The Publish() function is used to send a message to all subscribers of a channel. To publish a message you must first specify a valid PublishKey at initialization. A successfully published message is replicated across the PubNub Real-Time Network and sent simultaneously to all subscribed clients on a channel.
Messages in transit can be secured from potential eavesdroppers with SSL/TLS by setting ssl to true during initialization.
 
Publish Anytime
It is not required to be subscribed to a channel in order to publish to that channel.
Message Data:
The message argument can contain any JSON serializable data, including: Objects, Arrays, Ints and Strings. Message data should not contain special Unity V4 classes or functions as these will not serialize. String content can include any single-byte or multi-byte UTF-8 character.
Message Size:
The maximum number of characters per message is 32K by default. The maximum message size is based on the final escaped character count, including the channel name. An ideal message size is under 1800 bytes which allows a message to be compressed and sent using single IP datagram (1.5KB) providing optimal network performance.
If the message you publish exceeds the configured size, you will receive the following message:
Message Too Large Error
["PUBLISHED",[0,"Message Too Large","13524237335750949"]]

For further details please check: https://support.pubnub.com/support/discussions/topics/14000006322

Message Publish Rate:
Messages can be published as fast as bandwidth conditions will allow. There is a soft limit based on max throughput since messages will be discarded if the subscriber cannot keep pace with the publisher.
For example, if 200 messages are published simultaneously before a subscriber has had a chance to receive any messages, the subscriber may not receive the first 100 messages because the message queue has a limit of only 100 messages stored in memory.
Publishing to Multiple Channels.
It is not possible to publish a message to multiple channels simultaneously. The message must be published to one channel at a time.
Publishing Messages Reliably.
There are some best practices to ensure messages are delivered when publishing to a channel:
  • Publish to any given channel in a serial manner (i.e. not concurrently).
  • Check that the return code is success (e.g. [1,"Sent","136074940..."])
  • Publish the next message only after receiving a success return code.
  • If a failure code is returned ([0,"blah","<timetoken>"]), retry the publish.
  • Avoid exceeding the in-memory queue's capacity of 100 messages. An overflow situation (aka missed messages) can occur if slow subscribers fail to keep up with the publish pace in a given period of time.
  • Throttle publish bursts in accordance with your app's latency needs e.g. Publish no faster than 5 msgs per second to any one channel.
 
Do Not JSON serialize!
It is important to note that you should not JSON serialize when sending signals/messages via PUBNUB. Why? Because the serialization is done for you automatically. Instead just pass the full object as the message payload. PubNub takes care of everything for you.
 

Single string messages are automatically sent to APNS if mobile push is enabled and devices are registered for push on that channel. So if you use encryption (cipher key in the init) and publish the message, then it will be sent to APNS if there is a device(s) registered to that channel.

This is a legacy feature and will be deprecated soon.

To Publish a message you can use the following method(s) in the Unity V4 SDK:
  1. ParameterTypeRequiredDefaultsDescription
    ChannelstringYesDestination of the message.
    MessageobjectYesThe payload.
    UsePOSTboolOptional falseUse POST to publish.
    ShouldStoreboolOptionalaccount default

    Store in history.

    If shouldStore is not specified, then the history configuration on the key is used.

    MetaDictionary<string,string>OptionalNot setMeta data object which can be used with the filtering ability.
    PublishAsIsboolOptional false

    It should be set to true when you are going to Publish a JSON serialized string.

    By default it is set to false and the SDK takes care of JSON serializing the message for you.

    TtlintOptional
    Set a per message time to live in storage.
    1. If shouldStore = true, and Ttl = 0, the message is stored with no expiry time.
    2. If shouldStore = true and Ttl = X (X is an Integer value), the message is stored with an expiry time of X hours.
    3. If shouldStore = false, the Ttl parameter is ignored.
    4. If Ttl is not specified, then expiration of the message defaults back to the expiry value for the key.
    QueryParamDictionary<string, string>OptionalQueryParam accepts a Dictionary object, the keys and values are passed as the query string parameters of the URL called by the API.
    AsyncPNCallbackOptionalPNCallback of type PNPublishResult

Publish a message to a channel:

pubnub.Publish()
    .Channel("my_channel")
    .Message("Hello from the PubNub Unity SDK")
    .Async((result, status) => {
        if (!status.Error) {
            Debug.Log(string.Format("DateTime {0}, In Publish Example, Timetoken: {1}", DateTime.UtcNow , result.Timetoken));
        } else {
            Debug.Log(status.Error);
            Debug.Log(status.ErrorData.Info);
        }
    });
 
Before running the above publish example, either using the Debug Console, or in a separate script running in a separate terminal window, subscribe to the same channel that is being published to.
The Publish() operation returns a PNPublishResult which contains the following operations:
MethodTypeDescription
TimetokenlongReturns a long representation of the time token when the message was published.
  1. Dictionary<string, string> metaDict = new Dictionary<string, string>();
    metaDict.Add("region", "east");
    
    pubnub.Publish()
    	.Channel("my_channel")
    	.Message("Hello from the PubNub Unity SDK")
    	.Meta(metaDict)
    	.Async((result, status) => {
    		if (!status.Error) {
    			Debug.Log(string.Format("DateTime {0}, In Publish Example, Timetoken: {1}", DateTime.UtcNow , result.Timetoken));
    		} else {
    			Debug.Log(status.Error);
    			Debug.Log(status.ErrorData.Info);
    		}
    	});
  2. pubnub.Publish()
    	.Channel("my_channel")
    	.Message("Hello from the PubNub Unity SDK")
    	.Ttl(10)
    	.Async((result, status) => {
    		if (!status.Error) {
    			Debug.Log(string.Format("DateTime {0}, In Publish Example, Timetoken: {1}", DateTime.UtcNow , result.Timetoken));
    		} else {
    			Debug.Log(status.Error);
    			Debug.Log(status.ErrorData.Info);
    		}
    	});
The fire endpoint allows the client to send a message to PubNub Functions Event Handlers. These messages will go directly to any Event Handlers registered on the channel that you fire to and will trigger their execution. The content of the fired request will be available for processing within the Event Handler. The message sent via fire() is not replicated, and so will not be received by any subscribers to the channel. The message is also not stored in history.
To Fire a message you can use the following method(s) in the Unity V4 SDK:
  1. ParameterTypeRequiredDefaultsDescription
    ChannelstringYesDestination of the message.
    MessageobjectYesThe payload.
    MetaDictionary<string,string>OptionalNot setMeta data object which can be used with the filtering ability.
    PublishAsIsboolOptional falseIt should be set to true when you are going to Publish a JSON.
    usePOSTboolOptional falseUse POST to publish.
    TtlintOptional

    Set a per message time to live in storage.

    1. If shouldStore = true, and ttl = 0, the message is stored with no expiry time.
    2. If shouldStore = true and ttl = X (X is an Integer value), the message is stored with an expiry time of X hours.
    3. If shouldStore = false, the ttlparameter is ignored.
    4. If ttl is not specified, then expiration of the message defaults back to the expiry value for the key.
    QueryParamDictionary<string, string>OptionalQueryParam accepts a Dictionary object, the keys and values are passed as the query string parameters of the URL called by the API.
    AsyncPNCallbackOptionalPNCallback of type PNPublishResult

Fire a message to a channel:

pubnub.Fire()
	.Channel("my_channel")
	.Message("test fire message")
	.Async((result, status) => {
		if(status.Error){
			Debug.Log (status.Error);
			Debug.Log (status.ErrorData.Info);
		} else {
			Debug.Log (string.Format("Fire Timetoken: {0}", result.Timetoken));
		}
	});
This function causes the client to create an open TCP socket to the PubNub Real-Time Network and begin listening for messages on a specified channel. To subscribe to a channel the client must send the appropriate SubscribeKey at initialization.
By default a newly subscribed client will only receive messages published to the channel after the Subscribe() call completes.
If a client gets disconnected from a channel, it can automatically attempt to reconnect to that channel and retrieve any available messages that were missed during that period. This can be achieved by setting ReconnectionPolicy to PNReconnectionPolicy.LINEAR, when initializing the client.
 Unsubscribing from all the channel(s) and then subscribing to a new channel Y is not the same as Subscribing to channel Y and then unsubscribing from the previously subscribed channel(s). Unsubscribing from all the channels resets the timetoken and thus, there could be some gaps in the subscription that may lead to a message loss.
To Subscribe to a channel you can use the following method(s) in the Unity V4 SDK:
  1. ParameterTypeRequiredDescription
    ChannelsList<string>OptionalSubscribe to channels, Either channel or channelGroup is required.
    ChannelGroupsList<string>OptionalSubscribe to channel groups, Either channel or channelGroup is required.
    SetTimetokenlongOptionalPass a timetoken.
    WithPresenceboolOptionalAlso subscribe to related presence information.
    QueryParamDictionary<string, string>OptionalQueryParam accepts a Dictionary object, the keys and values are passed as the query string parameters of the URL called by the API.
    Execute()CommandYesCommand that will execute subscribe.
Subscribe to a channel:
pubnub.Subscribe()
    .Channels(new List<string>() {
        "my_channel"
    })
    .Execute();
The response of the call is handled by adding a Listener. Please see the Listeners section for more details. Listeners should be added before calling the method.
 

PNMessageResult is returned in the Listeners.

The Subscribe() operation returns a PNStatus which contains the following operations:
Property NameTypeDescription
Category PNStatusCategoryDetails of PNStatusCategory are here.
Error boolThis is true if an error occurred in the execution of the operation.
ErrorData PNErrorDataError data of the exception (if Error is true)
StatusCode intStatus code of the excution.
Operation PNOperationTypeOperation type of the request.
AffectedChannels List<string>A list of affected channels in the operation.
AffectedChannelGroups List<string>A list of affected channel groups in the operation.
The Subscribe() operation returns a PNMessageResult for messages which contains the following operations:
MethodTypeDescription
PayloadobjectThe message sent on the channel.
SubscriptionstringThe channel group or wildcard subscription match (if exists).
ChannelstringThe channel for which the message belongs.
TimetokenlongTimetoken for the message.
UserMetadataobjectUser metadata.
The Subscribe() operation returns a PNPresenceEventResult from presence which contains the following operations:
MethodTypeDescription
EventstringEvents like join, leave, timeout, state-change, interval.
UUIDstringUUID for the event.
TimestamplongTimestamp for the event.
OccupancyintCurrent occupancy.
StateobjectState of the UUID.
SubscriptionstringThe channel group or wildcard subscription match (if exists).
ChannelstringThe channel for which the message belongs.
TimetokenlongTimetoken of the message.
UserMetadataobjectUser metadata.
  1. PNConfiguration pnConfiguration = new PNConfiguration ();
    pnConfiguration.SubscribeKey = "my_subkey";
    pnConfiguration.PublishKey = "my_pubkey";
    pnConfiguration.LogVerbosity = PNLogVerbosity.BODY;
    pubnub = new PubNub (pnConfiguration);
    pubnub.Subscribe ().Channels(new List<string> (){"my_channel"}).Execute();
  2. Requires Stream Controller add-on XRequires that the Stream Controller add-on is enabled for your key. See this page on enabling add-on features on your keys:

    http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.
    It is possible to subscribe to more than one channel over a single TCP socket by taking advantage of Multiplexing feature. See the Multiplexing section for more info on this feature as well as the examples below using a list or an array to specify channel name.
    pubnub.Subscribe().
    	Channels(new List<string> (){"my_channel", "my_channel2"})
    	.Execute();
  3. Requires Presence add-on XRequires that the Presence add-on is enabled for your key. See this page on enabling add-on features on your keys:

    http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.

    For any given channel there is an associated Presence channel. You can subscribe directly to the channel by appending -pnpres to the channel name. For example the channel named my_channel would have the presence channel named my_channel-pnpres. Presence data can be observed inside the SubscribeCallback#message(PubNub, PNMessageResult) callback.

    pubnub.Subscribe()
    	.Channels(new List<string>() {
    		"my_channel"
    	})
    	.WithPresence()
    	.Execute();
    if(mea.PresenceEventResult.Event.Equals("join")){
    	Debug.Log(mea.PresenceEventResult.UUID);
    	Debug.Log(mea.PresenceEventResult.Timestamp);
        Debug.Log(mea.PresenceEventResult.Occupancy);
    }
    if(mea.PresenceEventResult.Event.Equals("leave")){
    	Debug.Log(mea.PresenceEventResult.UUID);
    	Debug.Log(mea.PresenceEventResult.Timestamp);
        Debug.Log(mea.PresenceEventResult.Occupancy);
    }
    if(mea.PresenceEventResult.Event.Equals("timeout")){
    	Debug.Log(mea.PresenceEventResult.UUID);
    	Debug.Log(mea.PresenceEventResult.Timestamp);
    	Debug.Log(mea.PresenceEventResult.Occupancy);
    }
    if(mea.PresenceEventResult.Event.Equals("state-change")){
    	Debug.Log(mea.PresenceEventResult.UUID);
    	Debug.Log(mea.PresenceEventResult.Timestamp);
    	Debug.Log(mea.PresenceEventResult.Occupancy);
    }
    if(mea.PresenceEventResult.Event.Equals("interval")){
    	Debug.Log(mea.PresenceEventResult.UUID);
    	Debug.Log(mea.PresenceEventResult.Timestamp);
    	Debug.Log(mea.PresenceEventResult.Occupancy);
    }

    When a channel is in interval mode with presence_deltas pnconfig flag enabled, the interval message may also include the following fields which contain an array of changed UUIDs since the last interval message.

    • joined
    • left
    • timedout

    For example, this interval message indicates there were 2 new UUIDs that joined and 1 timed out UUID since the last interval:

    if (mea.PresenceEventResult.Event.Equals("interval")) {
        Debug.Log(mea.PresenceEventResult.UUID);
        Debug.Log(mea.PresenceEventResult.Timestamp);
        Debug.Log(mea.PresenceEventResult.Occupancy) ;
        Debug.Log(string.Join(",",mea.PresenceEventResult.Join.ToArray()));
        Debug.Log(string.Join(",",mea.PresenceEventResult.Timeout.ToArray()));
    }
    

    If the full interval message is greater than 30KB (since the max publish payload is ∼32KB), none of the extra fields will be present. Instead there will be a here_now_refresh boolean field set to true. This indicates to the user that they should do a hereNow request to get the complete list of users present in the channel.

    {
        "Event": "interval",
        "Uuid": "175c2c67-b2a9-470d-8f4b-1db94f90e39e",
        "Timestamp": <unix timestamp>,
        "Occupancy": <# users in channel>,
        "State": null,
        "Channel": "my_channel",
        "Subscription": "",
        "Timetoken": 15034141109823424,
        "UserMetadata": null,
        "Join": null,
        "Timeout": null,
        "Leave": null,
        "HereNowRefresh": true
    }
    
  4. Requires Stream Controller add-on XRequires that the Stream Controller add-on is enabled with Enable Wildcard Subscribe checked for your key. See this page on enabling add-on features on your keys:

    http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.
    Wildcard subscribes allow the client to subscribe to multiple channels using wildcard. E.g., if you subscribe to a.* you will get all messages for a.b, a.c, a.x. The wildcarded * portion refers to any portion of the channel string name after the dot (.).
     
    3 levels (2 dots) of wildcarding is supported, e.g.:
    a.*
    a.b.*
    pubnub.Subscribe()
    	.Channels(new List<string> (){"foo.*"})
    	.Execute();
  5. Requires Presence add-on XRequires that the Presence add-on is enabled for your key. See this page on enabling add-on features on your keys:

    http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.
    Dictionary<string, object> state = new Dictionary<string, object>();
    state.Add("k", "v");
    PNConfiguration pnConfiguration = new PNConfiguration();
    pnConfiguration.SubscribeKey = "my_subkey";
    pnConfiguration.PublishKey = "my_pubkey";
    
    pubnub = new PubNub(pnConfiguration);
    pubnub.SubscribeCallback += (sender, e) => {
        SubscribeEventEventArgs mea = e as SubscribeEventEventArgs;
    
        if (mea.Status != null) {
            if (mea.Status.Category.Equals(PNStatusCategory.PNConnectedCategory)) {
                pubnub.SetPresenceState()
                    .ChannelGroups(channelGroupList)
                    .State(state)
                    .Async ((result, status) => {
                        if (status.Error) {
                            Assert.Fail("SetPresenceState failed");
                        }
                    });
                }
        }
        if (mea.MessageResult != null) {
            Debug.Log ("In Example, SubscribeCallback in message" + mea.MessageResult.Channel + mea.MessageResult.Payload);
        }
        if (mea.PresenceEventResult != null) {
            Debug.Log("In Example, SubscribeCallback in presence" + mea.PresenceEventResult.Channel + mea.PresenceEventResult.Occupancy + mea.PresenceEventResult.Event);
        }
    };
    
    pubnub.Subscribe()
        .Channels(new List<string> () {
            "my_channel"
        })
        .Execute();
  6. Requires Stream Controller add-on XRequires that the Stream Controller add-on is enabled for your key. See this page on enabling add-on features on your keys:

    http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.
    pubnub.Subscribe()
    	.ChannelGroups(new List<string> (){"my_channel_group"})
    	.Execute();
  7. Requires Stream Controller and Presence add-on XRequires that both Stream Controller and Presence add-ons are enabled for your key. See this page on enabling add-on features on your keys:

    http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.
    pubnub.Subscribe()
    	.ChannelGroups(new List<string> (){"family"})
    	.WithPresence()
    	.Execute();
When subscribed to a single channel, this function causes the client to issue a leave from the channel and close any open socket to the PubNub Network. For multiplexed channels, the specified channel(s) will be removed and the socket remains open until there are no more channels remaining in the list.
 Unsubscribing from all the channel(s) and then subscribing to a new channel Y is not the same as Subscribing to channel Y and then unsubscribing from the previously subscribed channel(s). Unsubscribing from all the channels resets the timetoken and thus, there could be some gaps in the subscription that may lead to a message loss.
To Unsubscribe from a channel you can use the following method(s) in the Unity V4 SDK
  1. ParameterTypeRequiredDescription
    ChannelGroupsList<string>OptionalUnsubscribe to channel groups, Either channel or channelGroup is required.
    ChannelsList<string>OptionalUnsubscribe to channels, Either channel or channelGroup is required.
    QueryParamDictionary<string, string>OptionalQueryParam accepts a Dictionary object, the keys and values are passed as the query string parameters of the URL called by the API.
    AsyncCommandYesCommand that will execute unsubscribe.
Unsubscribe from a channel:
pubnub.Unsubscribe()
	.ChannelGroups(new List<string>(){
		"my_channel_group"
	})
	.Channels(new List<string>() {
		"my_channel"
	})
	.Async((result, status) => {          
		if (status.Error) {
			Debug.Log(string.Format("Unsubscribe Error: {0} {1} {2}", status.StatusCode, status.ErrorData, status.Category));
		} else {
			Debug.Log(string.Format("DateTime {0}, In Unsubscribe, result: {1}", DateTime.UtcNow, result.Message));
		}
	});
The response of the call is handled by adding a Listener. Please see the Listeners section for more details. Listeners should be added before calling the method.
The Unsubscribe() operation returns a PNLeaveRequestResult which contains the following operations:
MethodTypeDescription
MessagestringThe message from the operation.
  1. Requires Stream Controller add-on XRequires that the Stream Controller add-on is enabled for your key. See this page on enabling add-on features on your keys:

    http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.
    pubnub.Unsubscribe()
    	.Channels(new List<string> (){"my_channel1", "my_channel2"})
    	.Async((result, status) => {
    
    		if(status.Error){
    			Debug.Log (string.Format("In Example, Unsubscribe Error: {0} {1} {2}", status.StatusCode, status.ErrorData, status.Category));
    		} else {
    		   Debug.Log (string.Format("DateTime {0}, In Unsubscribe, result: {1}", DateTime.UtcNow, result.Message));
    		}
    	});
    
    MethodTypeDescription
    MessagestringThe message from the operation.
  2. pubnub.Unsubscribe()
    	.ChannelGroups(new List<string> (){"my_channel_group", "my_channel_group_1"})
    	.Async((result, status) => {
                  
    		if(status.Error){
    			Debug.Log (string.Format("Unsubscribe Error: {0} {1} {2}", status.StatusCode, status.ErrorData, status.Category));
    		} else {
    			Debug.Log (string.Format("DateTime {0}, In Unsubscribe, result: {1}", DateTime.UtcNow, result.Message));
    		}
    	});
    
    MethodTypeDescription
    MessagestringThe message from the operation.
Unsubscribe from all channels and all channel groups
pubnub.UnsubscribeAll()
	.Async((result, status) => {
		if(status.Error){
			Debug.Log (string.Format("UnsubscribeAll Error: {0} {1} {2}", status.StatusCode, status.ErrorData, status.Category));
		} else {
			Debug.Log (string.Format("DateTime {0}, In UnsubscribeAll, result: {1}", DateTime.UtcNow, result.Message));
		}
	});
None

You can be notified of connectivity status, message and presence notifications via the listeners.

Listeners should be added before calling the method.

pubnub.SubscribeCallback += SubscribeCallbackHandler;

//Handler
void SubscribeCallbackHandler(object sender, EventArgs e) {
	SubscribeEventEventArgs mea = e as SubscribeEventEventArgs;

	if (mea.Status != null) {
		switch (mea.Status.Category) {
			case PNStatusCategory.PNUnexpectedDisconnectCategory:
			case PNStatusCategory.PNTimeoutCategory:
				pubnub.Publish()
					.Channel("my_channel")
					.Message("Hello from the PubNub Unity SDK")
					.Async((result, status) => {
						if(!status.Error){
							Debug.Log(string.Format("DateTime {0}, In Publish Example, Timetoken: {1}", DateTime.UtcNow , result.Timetoken));
						} else {
							Debug.Log(status.Error);
							Debug.Log(status.ErrorData.Info);
						}
					});
			break;
		}
	}
	if (mea.MessageResult != null) {
		Debug.Log("Channel" + mea.MessageResult.Channel);
		Debug.Log("Payload" + mea.MessageResult.Payload);
		Debug.Log("Publisher Id: " + mea.MessageResult.IssuingClientId);
	}
	if (mea.PresenceEventResult != null) {
		Debug.Log("SubscribeCallback in presence" + mea.PresenceEventResult.Channel + mea.PresenceEventResult.Occupancy + mea.PresenceEventResult.Event);
	}
}
pubnub.SubscribeCallback -= SubscribeCallbackHandler;
void SubscribeCallbackHandler(object sender, EventArgs e) {
	SubscribeEventEventArgs mea = e as SubscribeEventEventArgs;

	if (mea.Status != null) {
		switch (mea.Status.Category) {
			case PNStatusCategory.PNUnexpectedDisconnectCategory:
			case PNStatusCategory.PNTimeoutCategory:
				pubnub.Reconnect();
			break;
		}
	}
	if (mea.MessageResult != null) {
		Debug.Log("SubscribeCallback in message" + mea.MessageResult.Channel + mea.MessageResult.Payload);
	}
	if (mea.PresenceEventResult != null) {
		Debug.Log("SubscribeCallback in presence" + mea.PresenceEventResult.Channel + mea.PresenceEventResult.Occupancy + mea.PresenceEventResult.Event);
	}
}
CategoriesDescription
PNNetworkIssuesCategoryA subscribe event experienced connection issues when running.
PNReconnectedCategorySDK was able to reconnect to pubnub.
PNConnectedCategorySDK subscribed with a new mix of channels (fired every time the channel / channel group mix changed).
PNAcknowledgmentCategoryUsed API reported success with this status category.
PNAccessDeniedCategoryRequest failed because of access error (active PAM). status.AffectedChannels or status.AffectedChannelGroups contain list of channels and/or groups to which user with specified auth key doesn't have access.
PNTimeoutCategoryUsed API didn't receive a response from server in time.
PNDisconnectedCategoryClient unsubscribed from specified real-time data channels.
PNUnexpectedDisconnectCategorySubscribe loop failed and at this moment client is disconnected from real-time data channels. This could due to the machine or device is not connected to Internet or this has been lost, your ISP (Internet Service Provider) is having to troubles or perhaps or the SDK is behind of a proxy.
PNBadRequestCategoryRequest cannot be completed as not all required values have been passed (like subscribe key, publish key) or passed values are of unexpected data type.
PNMalformedFilterExpressionCategorySubscription request cannot be processed as the passed filter expression is malformed and cannot be evaluated.
PNMalformedResponseCategoryRequest received in response non-JSON data. It can be because of an error message from the proxy server (if applicable).
PNDecryptionErrorCategoryHistory API may return this status category in case if some messages can't be decrypted.
PNTLSConnectionFailedCategoryTLS handshake issues. In most cases is because of poor network quality and packets loss and delays.
PNRequestMessageCountExceededCategoryThis status event will be fired each time the client receives more messages than the value of RequestMessageCountThreshold, set in PNConfiguration.
PNReconnectionAttemptsExhausted
In case of network disconnect the PubNub client SDK will attempt to reconnect a finite number of times after which this status is sent and the re-connection attempts will stop.
PNUnknownCategoryPubNub SDK returns this error for SDK exceptions or when server responds with an error.

Go to Presence