+9
-2
@@ -25,13 +25,14 @@
|
|||||||
<script>
|
<script>
|
||||||
// ⚠️ En dev on utilise un token généré sans expiry
|
// ⚠️ En dev on utilise un token généré sans expiry
|
||||||
// En prod, ce token viendra de ton backend Go
|
// En prod, ce token viendra de ton backend Go
|
||||||
const TOKEN_SECRET = "bADmFI1tcYaMiISB3bJZjVpfTp4cvjUB"; // doit matcher config.json
|
const TOKEN_SECRET = "FG8kCsp87EDChgdFMLG9WZriBszYCRTP"; // doit matcher config.json
|
||||||
|
|
||||||
|
|
||||||
// Token JWT simple pour les tests (généré via jwt.io avec secret ci-dessus)
|
// Token JWT simple pour les tests (généré via jwt.io avec secret ci-dessus)
|
||||||
// Header: {"alg":"HS256","typ":"JWT"}
|
// Header: {"alg":"HS256","typ":"JWT"}
|
||||||
// Payload: {"sub":"user-test-1"}
|
// Payload: {"sub":"user-test-1"}
|
||||||
// Tu peux en générer un sur https://jwt.io avec le secret : mon-secret-jwt-dev-1234
|
// Tu peux en générer un sur https://jwt.io avec le secret : mon-secret-jwt-dev-1234
|
||||||
const TOKEN = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyLXRlc3QtMSJ9.HUYh6NE8LsmiBNHCJhk-CRY1MHvaFKFHZsvXw7ZL3Fw";
|
const TOKEN = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyLXRlc3QtMSJ9.Xu3kSu5qiAq1DZhyxCKGhTXy6JxBCnG3dbO1x59zSW0";
|
||||||
|
|
||||||
const log = document.getElementById('log');
|
const log = document.getElementById('log');
|
||||||
|
|
||||||
@@ -43,9 +44,15 @@
|
|||||||
log.scrollTop = log.scrollHeight;
|
log.scrollTop = log.scrollHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
const centrifuge = new Centrifuge('ws://192.168.4.109:8010/connection/websocket', {
|
const centrifuge = new Centrifuge('ws://192.168.4.109:8010/connection/websocket', {
|
||||||
token: TOKEN
|
token: TOKEN
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
|
const centrifuge = new Centrifuge('ws://localhost:8010/connection/websocket', {
|
||||||
|
token: TOKEN
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
centrifuge.on('connected', ctx => addLog('✅ Connecté au serveur Centrifugo'));
|
centrifuge.on('connected', ctx => addLog('✅ Connecté au serveur Centrifugo'));
|
||||||
centrifuge.on('disconnected', ctx => addLog('❌ Déconnecté'));
|
centrifuge.on('disconnected', ctx => addLog('❌ Déconnecté'));
|
||||||
|
|||||||
Reference in New Issue
Block a user