我正在使用网络套接字在Laravel中与vue.js聊天。在本地服务器上,它的工作正常,但是当我在实时服务器上发布它时,在控制台中显示错误
与'ws://b2xsolutions.com:6001 / app / shigri123?protocol = 7&client = js&version = 4.4.0&flash = false'的WebSocket连接失败:WebSocket在建立连接之前已关闭。
WebSocket connection to 'ws://b2xsolutions.com:6001/app/shigri123?protocol=7&client=js&version=4.4.0&flash=false' failed: WebSocket is closed before the connection is established.
bootstrap.js
import Echo from 'laravel-echo'
window.Pusher = require('pusher-js');
window.Echo = new Echo({
broadcaster: 'pusher',
key: process.env.MIX_PUSHER_APP_KEY,
wsHost: window.location.hostname,
wsPort: 6001,
disableStats: true,
encrypted: false,
});
broadcast.php
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'cluster' => env('PUSHER_APP_CLUSTER'),
'host' => '127.0.0.1',
'port' => 6001,
'scheme' => 'http'
],
],
.env
PUSHER_APP_ID=123456
PUSHER_APP_KEY = shigri123
PUSHER_APP_SECRET = shigri123
PUSHER_APP_CLUSTER = mt1
please help me i am tired from previous 1 week