Add debug logging for WebSocket messages and simplify connection close messages in LagoonAddons

This commit is contained in:
2026-05-27 11:22:44 +02:00
parent 8fe537f774
commit 4d4f78d5c1
2 changed files with 6 additions and 4 deletions

View File

@@ -11,6 +11,7 @@ class LagoonAddons {
async connect() {
this.ws = await websocket.connect('wss://lagoon.under-scape.com/ws/rooms/' + roomCode + '/plugins/proximity');
this.ws.afterEvents.message.subscribe((event) => {
console.log(`Lagoon Debug Message : ${event}`);
try {
const payload = JSON.parse(event.message);
const type = payload.type;
@@ -26,8 +27,8 @@ class LagoonAddons {
}
});
this.ws.afterEvents.close.subscribe((event) => {
utils.logStaff(`§cConnection to Lagoon closed. (${event})`);
console.log(`Connection to Lagoon closed. (${event})`);
utils.logStaff(`§cConnection to Lagoon closed.`);
console.log(`Connection to Lagoon closed.`);
utils.logStaff(`§eReconnecting in 5 seconds.`);
console.log(`Reconnecting in 5 seconds.`);
system.runTimeout(() => {

View File

@@ -17,6 +17,7 @@ class LagoonAddons {
this.ws = await websocket.connect('wss://lagoon.under-scape.com/ws/rooms/' + roomCode + '/plugins/proximity');
this.ws.afterEvents.message.subscribe((event) => {
console.log(`Lagoon Debug Message : ${event}`)
try {
const payload = JSON.parse(event.message);
@@ -32,8 +33,8 @@ class LagoonAddons {
}
});
this.ws.afterEvents.close.subscribe((event) => {
utils.logStaff(`§cConnection to Lagoon closed. (${event})`);
console.log(`Connection to Lagoon closed. (${event})`);
utils.logStaff(`§cConnection to Lagoon closed.`);
console.log(`Connection to Lagoon closed.`);
utils.logStaff(`§eReconnecting in 5 seconds.`);
console.log(`Reconnecting in 5 seconds.`);