laravel-echo-server icon indicating copy to clipboard operation
laravel-echo-server copied to clipboard

Invalid namespace

Open ihorchepurnyi opened this issue 5 years ago • 1 comments

I'm trying to connect to my webserver via laravel echo but got the following response

32:44/socket.io,"Invalid namespace"

I'm using the following configuration

location /socket.io {
	    proxy_pass http://127.0.0.1:6001;
	    proxy_http_version 1.1;
	    proxy_set_header Upgrade $http_upgrade;
	    proxy_set_header Connection "Upgrade";
	}

And laravel echo configuration

window.io = require('socket.io-client');

window.Echo = new Echo({
    broadcaster: 'socket.io',
    host: 'https://my-site.com/socket.io',
    auth: {
        headers: {
            'Authorization': 'Bearer some token here'
        }
    }
});

window.Echo.join('channel').joining((user) => {
    console.log('joining');
}).leaving((user) => {
    console.log('leaving');
})

ihorchepurnyi avatar Jan 12 '20 13:01 ihorchepurnyi

32:44/socket.io,"Invalid namespace"

Well, it means the namespace is not valid

use this instead host: 'https://my-site.com',

snarcraft avatar Apr 07 '20 10:04 snarcraft