Laravel-Echo套接字轮询失败

时间:2018-09-27 04:05:22

标签: socket.io laravel-5.1 laravel-echo

我试图在laravel5.1 Web应用程序中实现套接字连接 我的Web应用程序在Docker容器中运行。

我已经使用kylestev/laravel-echo-server设置了laravel-echo-server,并且按预期运行

enter image description here

import Echo from "laravel-echo"
window.io = require('socket.io-client');

if (typeof io !== 'undefined') {
    window.Echo = new Echo({
        broadcaster: 'socket.io',
        host: window.location.hostname + ':6001',
    });
}

window.Echo.channel('test-event')
    .listen('Eventname', (e) => {
        console.log(e);
});

当我在浏览器中加载页面时,轮询请求失败,并出现EMPTY_RESPONSE错误。

enter image description here

    {
    "authHost": null,
    "authEndpoint": null,
    "database": "redis",
    "databaseConfig": {
        "redis": {
            "port": "6379",
            "host": "redis"
        },
        "sqlite": {
            "databasePath": "/database/laravel-echo-server.sqlite"
        }
    },
    "devMode": true,
    "host": "hms.zuzurooms.local",
    "port": "6001",
    "protocol": "http",
    "socketio": {},
    "sslCertPath": "",
    "sslKeyPath": "",
    "sslCertChainPath": "",
    "sslPassphrase": "",
    "subscribers": {
        "http": true,
        "redis": true
    },
    "apiOriginAllow": {
        "allowCors": false,
        "allowOrigin": "",
        "allowMethods": "",
        "allowHeaders": ""
    }
}

0 个答案:

没有答案