PubNub APIs return status codes when operations are successful, and also when they're unsuccessful. The PubNub SDKs often make these status codes available, particularly for errors. In the case of an error, these codes should be handled on the client application; you may also need to display an error message to the user or retry the operation.
Refer to SDK troubleshooting and status event references on this page for links to a number of SDKs' troubleshooting and status-event reference pages.
HTTP Status Codes
The success or failure of each HTTP request is shown in the status field of the HTTP response header, which contains standard HTTP status codes:
- a 2xx or 3xx code for success
- a 4xx or 5xx code for failure
In addition to the standard status codes such as 200 (OK), 400 (bad request), and 404 (not found), here are some less-common status codes returned by PubNub operations. Note that functions may return other codes than these; you'll find details about return codes in each SDK's reference documentation.
|Message Actions||The action was deleted but the action-deletion message wasn't published.|
|General||The client isn’t authorized to perform this operation. Either the authorization key you provided doesn’t have the required permissions for this operation, or the generated signature is invalid.|
|Objects||Conditional operation can't be performed because the target object has changed since the last retrieval.|
|Objects||The format of the request body you supplied isn't supported. The request body must be in JSON format.|
|General||Request processing exceeded the maximum allowed time. Retry the request. If the error persists, contact PubNub Support.|
SDK troubleshooting and status event references
Here is a selected list of common client and server SDKs, with links to their troubleshooting and status event references. The documentation for each PubNub SDK includes a troubleshooting section detailing how to enable logging for that SDK, and a list of status events you may receive.
- C# .NET troubleshooting and status events
- Go troubleshooting and status events
- Java troubleshooting and status events
- Objective-C troubleshooting and status events
- Python troubleshooting and status events
- Swift troubleshooting and status events
- Unity troubleshooting and status events