why pusher works on localhost but not on a live website

こ雲淡風輕ζ 提交于 2020-01-06 04:05:14

问题


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/37851532/pusher-not-working-in-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!