遇到pusher-js v7.0.1的问题

时间:2020-11-11 08:29:08

标签: laravel events websocket pusher pusher-js

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

Broadcasting.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,
        ],
    ],```

Package.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"
    }
} ```


0 个答案:

没有答案