我正在尝试在宅基地SSL流浪者盒子上设置laravel网络套接字
是https://github.com/beyondcode/laravel-websockets
出现错误
Error during WebSocket handshake: Unexpected response code: 200
我的推送器信息如下
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'),
'encrypted' => true,
'host' => '127.0.0.1',
'port' => 6001,
'scheme' => 'http'
],
使用我的ENV:
BROADCAST_DRIVER=pusher
PUSHER_APP_KEY=193eac85dcfd18e61e3b
PUSHER_APP_SECRET=secret
PUSHER_APP_ID=ID
PUSHER_CLUSTER=eu
我已经安装了软件包并在运行的VM上启动了服务 php artisan websockets:serve
我的Bootstrap.js是:
import Echo from "laravel-echo"
window.Pusher = require('pusher-js');
window.Echo = new Echo({
broadcaster: 'pusher',
key: '193eac85dcfd18e61e3b',
wsHost: window.location.hostname,
wsPort: 6001,
disableStats: true,
enabledTransports: ['ws', 'wss']
});
我正在这样听:
window.Echo.channel("chat").listen("MessageSent", e => {
console.log(e);
this.messages.push(e);
});