Laravel 和 Pusher - API 消息未发送
Laravel and Pusher - API message not sent
我正在尝试让 Pusher 与我的 Laravel 应用程序一起工作。我有一个私人频道,用户已通过身份验证并连接到它。当我从 Pusher 调试控制台发送一条测试消息时,我在我的客户端上收到了条目。
我在从 L5 应用向推送器发送事件时遇到问题。事件被触发,在我的 L5 日志中我看到以下内容:
[2017-03-02 13:07:23] local.INFO: Broadcasting [App\Events\xyz] on channels [private-xyz_35] with payload:
{
"message": {
"user": "35",
"code": "KKKK1111"
},
"socket": null
}
我的.ENV文件和广播配置都配置正确。当我触发事件时,我在 Pusher 调试控制台中没有看到 API 消息。
谁能指出我做错了什么?
这是我的活动:
<?php
namespace App\Events;
use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
class xyz implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
/**
* Create a new event instance.
*
* @return void
*/
/**
* Only (!) Public members will be serialized to JSON and sent to Pusher
**/
public $message;
public function __construct($message)
{
$this->message = $message;
}
/**
* Get the channels the event should broadcast on.
*
* @return Channel|array
*/
public function broadcastOn()
{
return new PrivateChannel('xyz_' . $this->message['user']);
}
}
我刚刚意识到我忘记验证我的 Pusher 帐户上的电子邮件。经验证,一切正常(第一次使用Pusher)。
我正在尝试让 Pusher 与我的 Laravel 应用程序一起工作。我有一个私人频道,用户已通过身份验证并连接到它。当我从 Pusher 调试控制台发送一条测试消息时,我在我的客户端上收到了条目。
我在从 L5 应用向推送器发送事件时遇到问题。事件被触发,在我的 L5 日志中我看到以下内容:
[2017-03-02 13:07:23] local.INFO: Broadcasting [App\Events\xyz] on channels [private-xyz_35] with payload:
{
"message": {
"user": "35",
"code": "KKKK1111"
},
"socket": null
}
我的.ENV文件和广播配置都配置正确。当我触发事件时,我在 Pusher 调试控制台中没有看到 API 消息。
谁能指出我做错了什么?
这是我的活动:
<?php
namespace App\Events;
use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
class xyz implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
/**
* Create a new event instance.
*
* @return void
*/
/**
* Only (!) Public members will be serialized to JSON and sent to Pusher
**/
public $message;
public function __construct($message)
{
$this->message = $message;
}
/**
* Get the channels the event should broadcast on.
*
* @return Channel|array
*/
public function broadcastOn()
{
return new PrivateChannel('xyz_' . $this->message['user']);
}
}
我刚刚意识到我忘记验证我的 Pusher 帐户上的电子邮件。经验证,一切正常(第一次使用Pusher)。