php - Pusher doesn't send any signal from the backend
Get the solution ↓↓↓I started using Pusher.com with Laravel and this is my first experience with Pusher by the way. to create a small Chat application, but it seems like pusher doesn't work from the backend this is my code :
$options = [
'cluster' => 'us2',
'useTLS' => true
];
$pusher = new Pusher(
env('PUSHER_APP_KEY'),
env('PUSHER_APP_SECRET'),
env('PUSHER_APP_ID'),
$options
);
$data = ['from' => $from, 'to' => $to];
$pusher->trigger('my-channel', 'my-event', [
'message' => 'hello world'
]);
FrontEnd
<script src="https://js.pusher.com/6.0/pusher.min.js"></script>
<script>
// Enable pusher logging - don't include this in production
Pusher.logToConsole = true;
var pusher = new Pusher('myhiddenkey', {
cluster: 'us2'
});
var channel = pusher.subscribe('my-channel');
channel.bind('my-event', function(data) {
alert(JSON.stringify(data));
});
</script>
The pusher console works file when i debug on the pusher.com plateform
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: undefined array key php
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.