我正在尝试使用pusher实现广播。当我在本地主机上测试时,一切正常。但是一旦我在服务器上传文件,广播开始将数据放在日志上而不是推送到推送器。
这是我的活动
class MessageReceive implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public $message, $sender , $id;
public function __construct(Messenger $data)
{
$this->message = $data->message;
$this->sender = $data->people_id;
$this->id = $data->user_id;
}
public function broadcastOn()
{
return new Channel('message.' . $this->sender);
}
public function broadcastAs()
{
return 'MessageReceive';
}
public function broadcastWith()
{
return [
'id' => $this->id,
'sender' => $this->sender,
'message' => $this->message,
'time' => now(),
];
}
}
以下是我在日志文件中的内容..
[2018-03-31 18:34:35] local.INFO: Broadcasting [MessageReceive] on channels [message.1526560620] with payload:
{
"id": "1",
"sender": "1526560620",
"message": "hey buddy",
"time": {
"date": "2018-03-31 18:34:35.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"socket": null
}
我确实尝试重新启动队列,但它似乎无法正常工作