C-core status codes and user actions
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.
General Errors Handling
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
Also, increasing the C-core logging to maximum will output a lot of data useful in diagnosing the cause of errors/failures.
|Proceed with business as usual.
|Pubnub 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.
|Connecting 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.
|A 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.
|Time-out before the request has completed. This is reported for a time-out detected by PubNub client itself, not some reported by others (that is, the TCP/IP stack).
|Increase the transaction timeout you used. If that doesn't help, treat it like
|Connection to Pubnub aborted (in most cases, a TCP reset was received).
|This is unlikely, unless you're using a proxy - in which case, check the proxy. If not using proxy, please report this to PubNub.
|Communication 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.
|An 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.
|Unexpected 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.
|User cancelled a transaction.
|If you haven't cancelled a transaction, please report this to Pubnub.
|Transaction started - this is not an error code, but
|Await the final outcome.
|Transaction (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.
|Receive buffer (from previous transaction) not read, new subscription not allowed.
|Read the whole receive buffer.
|The transmit buffer is too small.
|Increase #PUBNUB_BUF_MAXLEN or divide your message to multiple segments.
|Channel specification / name is invalid.
|Use a valid channel name/specification.
|Publish transaction failed - error returned from Pubnub.
|To see the reason describing the failure, call
|A 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.
|Reply 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.
|An internal error in processing.
|Please report to Pubnub.
|Encryption (and decryption) not supported.
|Switch to a platform that supports encryption/decryption (like OpenSSL) or don't use it.