【发布时间】:2021-01-22 13:08:08
【问题描述】:
我正在尝试使用 this library 在本地主机上设置 laravel websockets
我已经安装了软件包并在我的本地主机上启动了服务,运行 php artisan websockets:serve
我的 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,
});
window.Echo.channel('DemoChannel').listen('WebsocketDemoEvent',(e) => function() {
console.log(e);
});
【问题讨论】:
标签: php laravel laravel-websockets