Posix C++Posix C++Windows C++C++Posix C++ SDK Status Events

These are the symbols from the enum pubnub_res which is used throughout the C-core API to convey the information about the outcome of a Pubnub transaction. They are used in both C and C++, on all platforms.

If your Pubnub transaction fails, you might want to retry. But, sometimes that may not be such a good idea. To that end, there is a function pubnub_should_retry() and its wrapper, member function should_retry() in C++. See their documentation about their usage.

To get a string describing a C-core status code, call pubnub_res_2_string().

Also, increasing the C-core logging to maximum will output a lot of data useful in diagnosing the cause of errors/failures.

Symbol/codeDescriptionUser action
PNR_OKTransaction success.Proceed with business as usual.
PNR_ADDR_RESOLUTION_FAILEDPubnub host name resolution failed. We failed to get an IP address from the Pubnub host name (origin). Most of the time, this comes down to a DNS error.Check your network, focusing on DNS issues.
PNR_CONNECT_FAILEDConnecting to Pubnub server failed. Most often, this means a network outage, but could be many things. If using SSL/TLS, it could be some of its errors. Check your network including any firewall/proxy.
If using SSL/TLS, check the errors reported, try using fallback.
PNR_CONNECTION_TIMEOUTA time-out happened in the network. Mostly, this is because a network outage happened while being connected to the Pubnub server, but could be other things.Treat this similarly to PNR_CONNECT_FAILED, but focus more on hardware / low level IP issues.
PNR_TIMEOUTTime-out before the request has completed. This is reported for a time-out detected by Pubnub client itself, not some reported by others (i.e. the TCP/IP stack).Increase the transaction timeout you used. If that doesn't help, treat it like PNR_CONNECTION_TIMEOUT.
PNR_ABORTEDConnection to Pubnub aborted (in most cases, a TCP reset was received).This is very unlikely, unless you're using a proxy - in which case, check the proxy. If not using proxy, please report this to PubNub.
PNR_IO_ERRORCommunication error (network or HTTP response format)If you're using a proxy, please check the proxy. Otherwise, this indicates some SW error, possibly problem in C-core itself. Please report this to PubNub.
PNR_HTTP_ERRORAn error reported in HTTP status code, not detected by some other means.This is a fallback to the cases that C-core hasn't covered yet. Call pubnub_last_http_code() to get the error code. Also, read the actual response to understand what was the problem.
PNR_FORMAT_ERRORUnexpected input in received JSON.If using a proxy, please check the proxy. Otherwise, this is most likely an error in C-core parsing, so please report this to PubNub.
PNR_CANCELLEDUser cancelled a transaction.If you haven't cancelled a transaction, please report this to Pubnub.
PNR_STARTEDTransaction started - this is not an error code, but information/status code.Await the final outcome.
PNR_IN_PROGRESSTransaction (already) ongoing. Can't start a new transaction while the old one is in progress.Await the final outcome of the current transaction or start it in another context.
PNR_RX_BUFF_NOT_EMPTYReceive buffer (from previous transaction) not read, new subscription not allowed.Read the whole receive buffer.
PNR_TX_BUFF_TOO_SMALLThe transmit buffer is too small.Increase #PUBNUB_BUF_MAXLEN or divide your message to multiple segments.
PNR_INVALID_CHANNELChannel specification / name is invalid.Use a valid channel name/specification.
PNR_PUBLISH_FAILEDPublish transaction failed - error returned from Pubnub.To see the reason describing the failure, call pubnub_last_publish_result().
PNR_CHANNEL_REGISTRY_ERRORA transaction related to channel registry failed - error returned from Pubnub.To see the reason describing the failure, get the value for key message from the response (which is a JSON object) and value for key status for the numeric code of the error.
PNR_REPLY_TOO_BIGReply is too big to fit in our reply buffer. This same error is reported if the reply buffer is statically or dynamically allocated.If using statically allocated buffer, increase the buffer size. Otherwise, this indicates you need more RAM.
PNR_INTERNAL_ERRORAn internal error in processing.Please report to Pubnub.
PNR_CRYPTO_NOT_SUPPORTEDEncryption (and decryption) not supported.Switch to a platform that supports encryption/decryption (like OpenSSL) or don't use it.