N
N
NikSIk312019-08-19 17:12:10
Laravel
NikSIk31, 2019-08-19 17:12:10

Laravel problem with private channel?

I'm not getting a private message on my second channel. (although it works for public ones)
created a channel in channels and wrote a comparison for the test:

Broadcast::channel('post.{id}', function ($user, $id) {
 // here only authorized users
    return 1 === 1;
});

further replaced from .channel to .private in JS
var channel = Echo.private('post.' + this.post.id);

also changed to PrivateChannel
public function broadcastOn()
    {
        return new PrivateChannel('post.'.$this->comment->post->id);
    }

It doesn't even output anything to the console. And the test launch from the pusher does not bring results. I logged in with two authorized under different browsers and accounts. and another one from a private tab without authorization. Doesn't come anywhere.
Although now changing in Js and in the channel itself from private to channel, everything will work.
If there is anything else that needs to be thrown off - please tell me, otherwise I could miss something

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question