问题
I've used Pusher API to put a simple push notification in place. I've tested everything and Pusher works on my localhost
. When I put the same code on a live website, Pusher doesn't publish my message. That's interesting to note that if I push from localhost I can see the message on the live version.
It seems that I have no problem subscribing to a channel, but the problem is that I cannot publish a message on the channel.
This is my code:
// Create pusher event
$pusher=Yii::app()->pusher;
$data = array('message'=>"myMessageContent");
$pusher->trigger('test_channel','my_event',$data);
Is there something that I'm unaware of?
EDIT 1:
This is the output I've got from debugging:
string(112) "Timestamp expired: Given timestamp (2014-08-15T17:40:26Z) not within 600s of server time (2014-08-15T09:10:29Z) "
My server time is exactly the same as my localhost (13:44), but here I see something different?! 17:40?
回答1:
server's clock was drifted considerably so I used ntpdate ntp.ubuntu.com
on terminal and corrected the time. To prevent future problems I put that in the crontab.
Phew...
来源:https://stackoverflow.com/questions/25323605/why-pusher-works-on-localhost-but-not-on-a-live-website