0

在 Laravel 中使用 Pusher-js 并将其显示在调试控制台上时遇到了麻烦。Pusher 连接成功,但在调试控制台上没有看到任何事件。我的凭据是正确的,它在几个小时前显示了一些东西,但从那时起就没有再次响应,如果我没有进行配置,我会有点困惑

广播.js

            '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',
            ],

            
        ],```






Boostrap.js


window.Pusher = require('pusher-js');
Pusher.logToConsole = true;


window.Echo = new Echo({
    broadcaster: 'pusher',
    key: process.env.MIX_PUSHER_APP_KEY,
    cluster: process.env.MIX_PUSHER_APP_CLUSTER,
    wsHost: window.location.hostname,
    forceTLS: false,
    wsPort: 6001,
    disableStats: true,
});


window.Echo.channel('chat').listen('ChatEvent',(e)=>{
    console.log(e)
}) ```


Websocket.js

        [
            'id' => env('PUSHER_APP_ID'),
            'name' => env('APP_NAME'),
            'key' => env('PUSHER_APP_KEY'),
            'secret' => env('PUSHER_APP_SECRET'),
            'path' => env('PUSHER_APP_PATH'),
            'capacity' => null,
            'enable_client_messages' => false,
            'enable_statistics' => true,
            'verify_peer' => false,
        ],
    ],```

包.json | devDependencies 和依赖关系

        "axios": "^0.19.2",
        "bootstrap": "^4.0.0",
        "cross-env": "^7.0.2",
        "jquery": "^3.2",
        "laravel-echo": "^1.9.0",
        "laravel-mix": "^5.0.1",
        "lodash": "^4.17.19",
        "popper.js": "^1.12",
        "pusher-js": "^7.0.1",
        "resolve-url-loader": "^3.1.2",
        "sass": "^1.20.1",
        "sass-loader": "^8.0.0",
        "vue": "^2.5.17",
        "vue-template-compiler": "^2.6.10"
    },
    "dependencies": {
        "v-toaster": "^1.0.3",
        "vue-chat-scroll": "^1.4.0",
        "websocket": "^1.0.32"
    }
} ```


4

0 回答 0