Closed faso-dev closed 2 years ago
You can try setting env. variables as
ABLY_KEY=
MIX_ABLY_KEY="${ABLY_KEY}"
and access it with
window.Echo = new Echo({
authEndpoint: '/broadcasting/auth?pusher=1', // Force use of AblyBroadcasterDeprecated
broadcaster: 'pusher',
key: process.env.MIX_ABLY_KEY.split(':')[0], // Use first part of the API key before : (colon)
wsHost: 'realtime-pusher.ably.io',
wsPort: 443,
disableStats: false,
encrypted: true,
});
As far as I remember, when you set env. variable
, it needs to be accessed prefixed with MIX
. So, the second variable MIX_ABLY_KEY
might not be needed. You can try both ways.
I am referencing code https://github.com/QSD-BiH/laravel-broacast-app/blob/feature/ably-integration/resources/js/bootstrap.js
and https://github.com/QSD-BiH/laravel-broacast-app/blob/feature/ably-integration/.env.example
You can try setting env. variables as
ABLY_KEY= MIX_ABLY_KEY="${ABLY_KEY}"
and access it with
window.Echo = new Echo({ authEndpoint: '/broadcasting/auth?pusher=1', // Force use of AblyBroadcasterDeprecated broadcaster: 'pusher', key: process.env.MIX_ABLY_KEY.split(':')[0], // Use first part of the API key before : (colon) wsHost: 'realtime-pusher.ably.io', wsPort: 443, disableStats: false, encrypted: true, });
As far as I remember, when you set
env. variable
, it needs to be accessed prefixed withMIX
. So, the second variableMIX_ABLY_KEY
might not be needed. You can try both ways. I am referencing code https://github.com/QSD-BiH/laravel-broacast-app/blob/feature/ably-integration/resources/js/bootstrap.js and https://github.com/QSD-BiH/laravel-broacast-app/blob/feature/ably-integration/.env.example
Thanks for support. So i solved the issue by adding another package : https://github.com/springboardVR/Laravel-Ably-Broadcaster and it work. But, i'll try your solution also to see if the issue will be resolved.
Thanks again
Hi, i try to use ably in my php project and i get this error when i try to dispatch an event :
"message": "Malformed message; invalid connectionKey. (See https://help.ably.io/error/40006 for help.)", "exception": "Ably\\Exceptions\\AblyRequestException", "file": "***/vendor/ably/ably-php/src/Http.php", "line": 195,
in my .env file, i've this configuration and i use laravel :
backend setup : https://laravel.com/docs/9.x/broadcasting#ably frontend : https://laravel.com/docs/9.x/broadcasting#client-ably
in frontend :