Skip to content

Version 2.1.0 - improved HTTP status handling

Compare
Choose a tag to compare
@vveljko vveljko released this 25 Apr 13:32
· 14 commits to master since this release

If Pubnub responds with a HTTP status code indicating a
failure, publish will not return NULL any more.
Of course, NULL will still be returned for other errors, like,
DNS failure, network failure, etc.

This is useful because user can read the whole HTTP
response body, which contains the reason for failure
(like "Quota exceeded").

If you care, you should check the HTTP status code class, like:

if (PubNub.get_last_http_status_code_class() != PubNub::http_scc_success) {
    Serial.print("Got HTTP status code error from PubNub, class: ");
    Serial.print((int)PubNub.get_last_http_status_code_class(), DEC);
}