I am creating a test app using Pusher
for real-time notification on Laravel 4
.
As I am testing the said API, I am having difficulties on making it work.
I have this on my routes.php
:
Route::get('pusher-test', function(){
return View::make('pages.test');
});
Route::any('test', function(){
$pusher = new Pusher('key','sect','app_key'); //my keys are correct.
$pusher->trigger('notificationChannel', 'userRegistration', []);
});
Then my pusherTest.js
file:
(function(){
var pusher = new Pusher('key');
var channel = pusher.subscribe('notificationChannel');
channel.bind('userRegistration', function(data){
$('.test').append('HEY!');
});
})();
My view page:
<html>
<head>
<meta charset="utf-8">
{{ HTML::style('_/css/bootstrap.css') }}
{{ HTML::style('_/css/mystyle.css') }}
</head>
<body>
<h2>HI!</h2>
<div class="test"></div>
{{ HTML::script('_/js/bootstrap.js') }}
{{ HTML::script('_/js/jquery.js') }}
{{ HTML::script('_/js/pusher/pusher.min.js')}}
{{ HTML::script('_/js/pusherTest.js')}}
</body>
</html>
When I try to observe the Debug Console
of my app on Pusher.com,
here's what I see:
But when I hit the test
route, it is not sending an event on my Pusher app, neither it sends the API message to my client. But if I will use the Create new Event
tester on debug console, sure enough it sends the API message and my client receives and updates it.
What do you think is happening why on my route it can't send the event to my pusher app? I can't figure it out because is has no exception error. Please advice.