detect disconnect

This commit is contained in:
Bingus_Violet 2024-02-18 06:34:43 -06:00
parent fcfacb1e96
commit 4f9a8c6413

View file

@ -70,6 +70,10 @@ lanyard.addEventListener("message", async (res) => {
} }
}) })
lanyard.on('disconnect', () => {
console.log("Disconnected")
})
// wsServer = new WebSocket.WebSocketServer({ port: 8090 }) // wsServer = new WebSocket.WebSocketServer({ port: 8090 })
wsServer = WebSocket.Server; wsServer = WebSocket.Server;
let server = require('http').createServer() let server = require('http').createServer()
@ -82,7 +86,6 @@ server.on('request', app)
wsServer.on("connection", function connection(socket) { wsServer.on("connection", function connection(socket) {
socket.on('message', function message(data) { socket.on('message', function message(data) {
data = JSON.parse(data) data = JSON.parse(data)
console.log(data)
if (data.op == 3) { if (data.op == 3) {
for (let index = 0; index < sockets.length; index++) { for (let index = 0; index < sockets.length; index++) {
const socketData = sockets[index]; const socketData = sockets[index];