fix: mode dev avec proxy WebSocket, mode prod avec HTTP direct
- Mode dev : proxy Vite /livekit → ws://localhost:7880 (évite mixed content) - Mode prod : HTTP direct, pas de HTTPS (auto-hébergé local) - Détection automatique du mode via import.meta.env.DEV - En production réelle, HTTPS sera géré par reverse proxy
This commit is contained in:
+9
-3
@@ -100,11 +100,17 @@ function App() {
|
|||||||
|
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
|
|
||||||
// Utiliser directement l'URL LiveKit fournie par le serveur
|
// En mode dev (HTTPS via Vite), utiliser le proxy WebSocket
|
||||||
const livekitUrl = data.url;
|
// En mode prod (HTTP direct), utiliser l'URL LiveKit directement
|
||||||
|
let livekitUrl = data.url;
|
||||||
|
|
||||||
|
if (import.meta.env.DEV && window.location.protocol === 'https:') {
|
||||||
|
// Mode dev avec Vite : utiliser le proxy WSS
|
||||||
|
livekitUrl = `${window.location.protocol}//${window.location.host}/livekit`;
|
||||||
|
}
|
||||||
|
|
||||||
console.log('🔗 Connexion LiveKit:', livekitUrl);
|
console.log('🔗 Connexion LiveKit:', livekitUrl);
|
||||||
console.log('📝 Token:', data.token.substring(0, 50) + '...');
|
console.log('📝 Mode:', import.meta.env.DEV ? 'dev' : 'prod');
|
||||||
|
|
||||||
// Se connecter à LiveKit avec les canaux virtuels
|
// Se connecter à LiveKit avec les canaux virtuels
|
||||||
await connect(livekitUrl, data.token, data.virtualChannels || []);
|
await connect(livekitUrl, data.token, data.virtualChannels || []);
|
||||||
|
|||||||
Reference in New Issue
Block a user