I need to package multiple data items in PHP and publish them, how do I do that?
Instead of sending a string, send a structured message object as follows:
$big_array = array(); $big_array["msg"]["say"] = "hello"; $big_array["msg"]["what"] = "world"; $big_array["msg"]["contents"] = $myWords; $publish_success = $pubnub->publish( array( 'channel' => $pub_channel, 'message' => $big_array));
On the subscriber side, access the elements (say, what, contents) of
$big_array as needed.