我在pusher中没有收到api消息(调试控制台)

时间:2019-12-14 15:02:38

标签: php laravel pusher

我正在尝试使用Pusher在laravel应用中进行一对一聊天 但我没有将API消息从我的应用程序发送到推送器调试控制台。

它表明其他所有事物都接受了这一点, 在用户之间创建会话时,它将在会话数据库中创建一个会话ID,并应在api消息中显示。.

我的代码:- SessionEvent

int my_function(int a, int b) {
    int c, d;

    if (a == 5) {
        c = 6;
        d = 7;
    } else {
        c = 8;
        d = 9;
    }
    return c + d;
}

SessionController.php

<?php

namespace App\Events;

use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;

class SessionEvent implements ShouldBroadcast
{
    use Dispatchable, InteractsWithSockets, SerializesModels;
    /**
     * Create a new event instance.
     *
     * @return void
     */

    public $session;
    public $session_by;

    public function __construct($session, $session_by)
    {
        $this->session = $session;
        $this->session_by = $session_by;
        //$this->dontBroadcastToCurrentUser();
    }
    /**
     * Get the channels the event should broadcast on.
     *
     * @return \Illuminate\Broadcasting\Channel|array
     */
    public function broadcastOn()
    {
        return new Channel('Chat');
    }
}

请让我知道我的错误在哪里...

谢谢

0 个答案:

没有答案