简体   繁体   中英

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.

在此处输入图片说明

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在此处输入图片说明

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在此处输入图片说明

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":{}}

事实证明,无论出于何种原因,socket.io 客户端都无法工作,需要降级到 2.4.0 版。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM