Status Events for Java SDK

Subscribe

Current categoryDeprecated categoryDescription
None
PNNetworkUpCategory
The SDK detected that the network is online.
None
PNNetworkDownCategory
The SDK announces this when a connection isn't available, or when the SDK isn't able to reach PubNub servers.
PNUnexpectedDisconnectCategory
PNNetworkIssuesCategory
Subscribe loop failed, and the client disconnected from real-time data channels.
None
PNReconnectedCategory
The SDK was able to reconnect to PubNub.
PNConnectedCategory
PNConnectedCategory
SDK subscribed with a new mix of channels.
None
PNAccessDeniedCategory
Access Manager permission failure.
PNMalformedResponseCategory
PNMalformedResponseCategory
JSON parsing crashed.
None
PNBadRequestCategory
The server responded with a bad response error because the request is malformed.
None
PNDecryptionErrorCategory
If using decryption strategies and the decryption fails.
None
PNTimeoutCategory
Failure to establish a connection to PubNub due to a timeout.
None
PNRequestMessageCountExceedCategory
The SDK announces this error if requestMessageCountThreshold is set, and the number of messages received from PubNub (in-memory cache messages) exceeds the threshold.
PNDisconnectedCategory
PNDisconnectedCategory
The subscription has been stopped. SDK usubsrcibed from all channels.
PNConnectionError
None
The subscribe loop connection cannot be initialized.
PNSubscriptionChanged
None
SDK subscribed with a new mix of channels since the initial connection - subscribed to another channel or unsubscribed from a channel while still being subscribed to other channels.
Fired every time the channel/channel group mix changes.

Non-subscribe

For non-subscribe requests like publish, there is no PNStatus returned. Instead, a Result class is used, which can either be a success or a failure.

Success and failure handling

On success, the Result class delivers the returned value (e.g., PNPublishResult). On failure, it delivers a PubNubException.

Publish success and failure handling example

pubNub.publish("abc", "test").async {
it.onSuccess { result: PNPublishResult ->
println(result)
}.onFailure { exception: PubNubException ->
println(exception)
}
}
Last updated on