在播放Pusher事件时,我收到了以下错误:
(1/1) BroadcastException Timestamp expired: Given timestamp (2017-10-18T00:55:07Z) not within 600s of server time (2017-10-17T12:23:17Z) in PusherBroadcaster.php (line 106) at
PusherBroadcaster->broadcast(array(object(PrivateChannel)), 'App\\Events\\TestEvent', array('message' => 'How are you')) in BroadcastEvent.php (line 48) at
BroadcastEvent->handle(object(PusherBroadcaster)) at
call_user_func_array(array(object(BroadcastEvent), 'handle'), array(object(PusherBroadcaster))) in BoundMethod.php (line 29) at
BoundMethod::Illuminate\Container\{closure}() in BoundMethod.php (line 87) at
BoundMethod::callBoundMethod(object(Application), array(object(BroadcastEvent), 'handle'), object(Closure)) in BoundMethod.php (line 31) at
BoundMethod::call(object(Application), array(object(BroadcastEvent), 'handle'), array(), null) in Container.php (line 539) at
Container->call(array(object(BroadcastEvent), 'handle')) in Dispatcher.php (line 94) at
Dispatcher->Illuminate\Bus\{closure}(object(BroadcastEvent)) in Pipeline.php (line 114) at
Pipeline->Illuminate\Pipeline\{closure}(object(BroadcastEvent)) in Pipeline.php (line 102)
我正在使用Windows。
这是错误消息:Timestamp expired: Given timestamp (2017-10-18T00:55:07Z) not within 600s of server time (2017-10-17T12:23:17Z)
。
我已经正确配置了我的Pusher广播并触发了事件,但后来没有。
以下是Laravel堆栈跟踪和Pusher调试控制台的屏幕截图。
如何解决此问题?
答案 0 :(得分:2)
如果您使用的是Vagrant / Homestead,当您的计算机进入睡眠状态时,您的系统时间可能会发生变化并变得不同步。
vagrant ssh
sudo apt install ntpdate
sudo ntpdate ntp.ubuntu.com
sudo timedatectl set-ntp on
sudo service ntp stop
sudo ntpd -gq
sudo service ntp start
然后
cd /path/to/homestead
vagrant plugin install vagrant-vbguest
vagrant halt
vagrant up
我有同样的问题,以这种方式纠正我的系统时间为我解决了它。这里的讨论很有帮助: https://github.com/laravel/homestead/issues/799
答案 1 :(得分:1)
看起来错误非常清楚,事件的时间戳(2017-10-18T00:55:07Z)比当前服务器时间(2017-10-17T12:23:17Z)超过600秒。所以其中一个是错的。因此,检查代码是否正确设置时间戳,并检查服务器时间是否正确。