Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Check and Return The Received Message
require __DIR__ . '/vendor/autoload.php';
// Change the following with your app details:
// Create your own pusher account @
$options = array(
   'cluster' => 'ap2',
   'encrypted' => true
 $pusher = new Pusher\Pusher(
// Check the receive message
if(isset($_POST['message']) && !empty($_POST['message'])) {
  $data = $_POST['message'];
// Return the received message
if($pusher->trigger('test_channel', 'my_event', $data)) {
echo 'success';
} else {
echo 'error';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment