mardi 21 mai 2019

Using Laravel Echo with Nginx (websockets)

I have set up an Nginx-server that has installed the Nchan module in order to support websockets and long-polling. However, I am trying to set Laravel-Echo (client side javascript package using npm) to connect to the path where Nchan is listening.

My setup looks like this:

import Echo from 'laravel-echo'

window.Echo = new Echo({
    broadcaster: 'socket.io',
    host: 'http://localhost',
    path: '/sub?id=121',
    auth:
    {
        headers:
        {
            'Authorization': 'Bearer '
        }
    }
});

The problem is that when I debug I see that Laravel echo makes a request to: sub?id=121

Is it possible to remove the /?EIO=3&transport=polling&t=MhPTMVC part as this makes problems and garbage information (not needed) when Nginx handles the request.

Note I do not use socket.io but as far as I can see Laravel Echo only supports pusher, redis and pusher?

Thanks for any help!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire