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