This example show how to subscribe, and once that is successful, publishing a message to that channel. It also demonstrates the full set of parameters that can be included in the subscribe's message callback function.
pubnub = PUBNUB({
publish_key : 'your_pub_key',
...