Status Events for PubNub Java SDK

Subscribe

Current categoryDeprecated categoryDescription
NonePNNetworkUpCategoryThe SDK detected that the network is online.
NonePNNetworkDownCategoryThe SDK announces this when a connection isn't available, or when the SDK isn't able to reach PubNub servers.
PNUnexpectedDisconnectCategoryPNNetworkIssuesCategorySubscribe loop failed, and the client disconnected from real-time data channels.
NonePNReconnectedCategoryThe SDK was able to reconnect to PubNub.
PNConnectedCategoryPNConnectedCategorySDK subscribed with a new mix of channels.
NonePNAccessDeniedCategoryAccess Manager permission failure.
PNMalformedResponseCategoryPNMalformedResponseCategoryJSON parsing crashed.
NonePNBadRequestCategoryThe server responded with a bad response error because the request is malformed.
NonePNDecryptionErrorCategoryIf using decryption strategies and the decryption fails.
NonePNTimeoutCategoryFailure to establish a connection to PubNub due to a timeout.
NonePNRequestMessageCountExceedCategoryThe SDK announces this error if requestMessageCountThreshold is set, and the number of messages received from PubNub (in-memory cache messages) exceeds the threshold.
PNDisconnectedCategoryPNDisconnectedCategoryThe subscription has been stopped. SDK usubsrcibed from all channels.
PNConnectionErrorNoneThe subscribe loop connection cannot be initialized.
PNSubscriptionChangedNoneSDK 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