Skip to content

Instantly share code, notes, and snippets.

@styks1987
Created June 10, 2017 18:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save styks1987/4bd74b1f35983c4c33c630d503194c45 to your computer and use it in GitHub Desktop.
Save styks1987/4bd74b1f35983c4c33c630d503194c45 to your computer and use it in GitHub Desktop.
<?php
$pusher = new \Pusher(
env('PUSHER_AUTH_KEY', null),
env('PUSHER_APP_SECRET', null),
env('PUSHER_APP_ID', null),
$options
);
$data['message'] = 'Order ' . $order->id . ' was updated';
$pusher->trigger('order', 'updated', $data);
?>
The javascript
<script>
const pusher = new Pusher(pusherAuthKey, {
encrypted: true
});
const channel = pusher.subscribe('order');
channel.bind('updated', this.getOrders)
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment