#Pusher immediately disconnects

13 messages · Page 1 of 1 (latest)

hushed junco
#

I get the following error trying to implement pusher into my laravel 10 app.
local.ERROR: Pusher error: Not found. {"exception":"[object] (Illuminate\\Broadcasting\\BroadcastException(code: 0): Pusher error: Not found.

I have everything setup according to the documentation.

The error occurs first when i try to broadcast an event.

hushed junco
#

So i got it working to the part where I can send the event, but my client is not picking it up.

dapper canyon
hushed junco
#

I am not using laravel-websockts. i am using pusher

#

my issue seems to be Echo. Using the normal pusher sdk i get results for public channels. i would like to use private channels so getting echo to work would be great since that handles authentication for me

dapper canyon
#

Isn't echo using websockets?

hushed junco
#

Echo is the laravel library. i am using pusher-js not the laravel websockets

#

echo is a wrapper for pusher-js

#

Pusher immediately disconnects

#

Code in my bootstrap.js

window.Echo = new Echo({
    broadcaster: 'pusher',
    key: import.meta.env.VITE_PUSHER_APP_KEY,
    cluster: import.meta.env.VITE_PUSHER_APP_CLUSTER,
});

window.Echo.connector.pusher.connection.bind('initialized', () => {
    console.log('Pusher initialized!');
});

window.Echo.connector.pusher.connection.bind('connecting', () => {
    console.log('Pusher connecting!');
});

window.Echo.connector.pusher.connection.bind('connected', () => {
    console.log('Pusher connected!');
});

window.Echo.connector.pusher.connection.bind('unavailable', () => {
    console.log('Pusher connection unavailable!');
});

window.Echo.connector.pusher.connection.bind('failed', () => {
    console.log('Pusher connection failed!');
});

window.Echo.connector.pusher.connection.bind('disconnected', () => {
    console.log('Pusher disconnected!');
});
#

In my vue component i am using this:

mounted() {
    window.Echo.private('my-channel', 'message', (data) => {
        console.log(data);
    });
}
#

My log shows the following content:

[vite] connecting...
[vite] connected.
Pusher :  : ["State changed","initialized -> connecting"]
Pusher :  : ["Connecting",{"transport":"ws","url":"wss://ws-eu.pusher.com:443/app/9c97ffde3d252a2ceec5?protocol=7&client=js&version=8.4.0-rc2&flash=false"}]
Pusher :  : ["State changed","connecting -> connected with new socket ID 175655.3585068"]
Pusher connected!
Pusher :  : ["Event recd",{"event":"message","channel":"private-my-channel","data":"not working"}]
Pusher :  : ["No callbacks on private-my-channel for message"]
#

So clearly my echo is not registering the callbacks for some reason.