'Soketi with Laravel in different domains
I'm trying to use real-time notifications using Soketi
So I createg the Soketi server in one separeted server with nodejs on port 6001 and SSL using letsencrypt.
Then I Created the notification
Added the JS script to layout:
Echo.private('App.User.' + {{Auth::id()}})
.notification((data) => {
console.log(data);
});
Added the this code compiled in layout too:
import Echo from 'laravel-echo';
window.Pusher = require('pusher-js');
window.Echo = new Echo({
broadcaster: 'pusher',
key: process.env.MIX_PUSHER_APP_KEY,
wsHost: process.env.MIX_PUSHER_HOST,
wsPort: process.env.MIX_PUSHER_PORT,
wssPort: process.env.MIX_PUSHER_PORT,
forceTLS: false,
encrypted: true,
disableStats: true,
enabledTransports: ['ws', 'wss'],
});
So when I was in development ambient the notifications cakes properly, sended by one server without SSL (http://sede.inoprime.com.br), but when I was on production server It not work and this server has SSL and its diferent from Soketi server. Application Laravel (https://trackerprime.inoprime.com.br) Soketi Server (https://servicos.inoprime.com.br)
I found this two diferences when the aplications calls the websocket link: wss://servicos.inoprime.com.br:6001/app/app-key?protocol=7&client=js&version=7.0.6&flash=false
In development the response is:
{event: "pusher_internal:subscription_succeeded", channel: "private-App.User.1"}
In Production I got:
{
"event": "pusher:connection_established",
"data": "{"socket_id":"8565042074.5045547206","activity_timeout":30}"
}
Anyone have any idea what they might be getting?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
