Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not receiving notification 1.3.1 #135

Closed
msonowal opened this issue Jul 26, 2017 · 14 comments
Closed

Not receiving notification 1.3.1 #135

msonowal opened this issue Jul 26, 2017 · 14 comments

Comments

@msonowal
Copy link

msonowal commented Jul 26, 2017

After I updated to v1.3.1 it my echo on client side not working i.e. I was listening to private channel
on notification which is not getting executed.
which was working fine previously. below is the code
Echo.private('user.' + User.id)
.notification((notification) => {
console.debug('Notification received ', notification);
});
but after digging for sometime if I do something like this I can get the event but it feels dirty

.listen('Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', (e) => {
console.log('Event Notification received ', e)
})

and here is my EchoInstance

const EchoInstance = new Echo({
broadcaster: 'socket.io',
host: window.location.hostname + ':6001',
namespace: 'booking_app.Events',
});

@nguyenhaiphan
Copy link

I don't know why but I got this too, maybe the temporarily workaround is to stay with the old version of this package.

@SergeyMiracle
Copy link

Same here, 1.3.0 not working

@lukepolo
Copy link

I had to revert to 1.3.0 as well, looking into what changed in 1.3.1 now

@sietzekeuning
Copy link

I also had to change the listener to:
.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated'
after that change it was listening as expected to the notifications.

@indigoram89old
Copy link

indigoram89old commented Jul 28, 2017

I resolved this using namespace option.

In my case it:
namespace: ''

Event:
public function broadcastAs() { return 'updated'; }

Echo instance:
window.Echo = new Echo({ namespace: '' });

In component:
.listen('updated', e => {})

Documentation:
https://laravel.com/docs/5.4/broadcasting#namespaces

@matrunchyk
Copy link

Same here. Right after the update. I suspect it caused by this commit.

matrunchyk referenced this issue Jul 30, 2017
matrunchyk pushed a commit to matrunchyk/echo that referenced this issue Jul 31, 2017
@msonowal
Copy link
Author

msonowal commented Aug 7, 2017

this got fixed in v1.3.2

@msonowal msonowal closed this as completed Aug 7, 2017
@carlcassar
Copy link

@msonowal @taylorotwell or maybe not.

The dot notation is not working for us in 1.3.2. We've reverted to 1.3.0 for it to work. Alternatively using the escaped backslashes as suggested by @sietzekeuning also works.

Any advice on this?

@catalinux
Copy link

@carlcassar : does it help? #147

@vesper8
Copy link

vesper8 commented Sep 3, 2017

there's an hour i'll never get back :(

running 1.3.2 and it's not fixed, in the sense that my app with dot notation needed to be changed to escaped slashes

thanks @sietzekeuning for the solution

@legreco
Copy link

legreco commented Oct 26, 2017

@carlcassar i reverted to 1.3.0 an i have the same problem. Which version should i use?

@fsarter
Copy link

fsarter commented Mar 27, 2019

I found that broadcast notification is passed on the default channel, which is named by the namespace of notifiable entity model. So i solved the problem by customizing the notification channel.

reference link, and the code:

<?php

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use Notifiable;

    /**
     * The channels the user receives notification broadcasts on.
     *
     * @return string
     */
    public function receivesBroadcastNotificationsOn()
    {
        return 'users.'.$this->id;
    }
}

Hoping to help someone.

@Myestery
Copy link

I'm still having the same issue using laravel echo version 1.8.0

@gabrielpuzl
Copy link

public function receivesBroadcastNotificationsOn()
{
return 'users.'.$this->id;
}

thanks veryfull!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests