Add debug logging for WebSocket messages and simplify connection close messages in LagoonAddons
This commit is contained in:
@@ -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(() => {
|
||||
|
||||
@@ -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.`);
|
||||
|
||||
Reference in New Issue
Block a user