Whether publishing a message via the REST API or a PubNub client library method call, a JSON response is expected with either success (1) or failure (0) as a status preamble. When a message is published successfully to PubNub, the server responds with a receipt JSON of the form
[1, "Sent", TIMETOKEN].
In some cases a fatal error is thrown, for example when a publish key or a channel name is not provided. Also, if a message is too large, a 400 error code is currently thrown, not a failure JSON, but that may change in the future.