Search code examples
phplaravellaravel-echolaradock

laravel echo server with laradock


I'm trying to setup laravel echo server with docker and socket.io.

Backend seems to be working fine when I send event from laravel it shows up in laravel echo logs.

enter image description here

But when I try to connect from frontend it doesn't show anything in logs. From what I've gathered every connection should show up like this enter image description here

But I get nothing.

My client code:

window.echo = new Echo({
    broadcaster: 'socket.io',
    host: 'localhost' + ':6001'
});

window.echo.channel('laravel_database_test')
    .listen('.Test', e => {
        console.log(e)
    })

When I open browser requests it keeps sending request to

http://localhost:6001/socket.io/?EIO=4&transport=polling&t=NqPSDER

and response

96:0{"sid":"aMA7f9VU7IQwT1UcAADu","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":5000}2:40

But they are started right after new Echo(...) when I call window.echo.channel(..) no additional requests being sent.

EDIT

I noticed that ws is connected successfully enter image description here

I also checked laravel echo API but not sure what it means

**apps/../status**
{"subscription_count":5,"uptime":394.2726654,"memory_usage":{"rss":75575296,"heapTotal":20889600,"heapUsed":19851984,"external":1030517,"arrayBuffers":87478}}

**apps/../channels**
{"channels":{}}

Solution

  • Turns out that for whataever reason socket.io client doesn't work and needs to be downgraded to version 2.4.0.