During the tour you may want access to your IDE or new windows to see your code working. You’ll get the best experience viewing on a larger device.

Send messages

Sending messages requires knowing the channel name and having an actual message you wish to send. There is no specific mechanism to create new channels - they are created automatically by simply subscribing, or publishing to a new channel name.

The publish function lets you specify all of the above, and then send the message. After sending a message, PubNub servers return a message timetoken, which lets you do further actions like retrieving/auditing messages at a later date.

Messages are received using a listener. The interactive section below will automatically create a message listener for you.

Try it out

  • Change the text attribute in the message body

  • Publish your message

  • Add other JSON to the message to publish across multiple attributes

Read about message payloads

Subscribe to my_channel

See for yourself

You can publish the same thing with this curl command.

See it working for real!Open the PubNub debug console in a new tabor scan this QR code.