Publish lets you send a message to a channel.
Returns a three-element array:
- Array element 0 - (Integer)
1is a success, and
0is an error.
- Array element 1 - (String) Description of the success or error, if available.
- Array element 2 - (String) The current PubNub time expressed as a timetoken.
A sample response from the server [
1,"Sent","14375189629170609"] contains the following fields:
- The first element is an integer of value
- The second element is a string description of the success, which for
200response codes will always be "Sent."
- The third element is the string timetoken value the system accepted the Publish operation at.
Errors specific to Publish will occur when the URL (for example, message payload) is too large (>=32K) and invalid publish and/or subscribe keys are used.
In the event of an error, you will receive a non-
200 HTTP status code and a two-element array. You can parse the second element of the returned array for a description of the error.