diff options
| author | Adam Soltys <[email protected]> | 2023-12-01 11:36:35 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-12-01 11:36:35 -0800 |
| commit | 7709c1efde9a1f3078171ee56985cd25511d6f7b (patch) | |
| tree | cd996eaaa860cdb3d7da688e0ad4c5ec7bae1a0c /lib/sockets.js | |
| parent | 826c7b361c93905c4725755038d398221530051d (diff) | |
| download | coinos-server-7709c1efde9a1f3078171ee56985cd25511d6f7b.tar.gz coinos-server-7709c1efde9a1f3078171ee56985cd25511d6f7b.zip | |
biome formatter
Diffstat (limited to 'lib/sockets.js')
| -rw-r--r-- | lib/sockets.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/sockets.js b/lib/sockets.js index 03ad6752..46fda67c 100644 --- a/lib/sockets.js +++ b/lib/sockets.js @@ -41,7 +41,7 @@ export const broadcast = (type, data) => { } } - Object.values(all).map(ws => { + Object.values(all).map((ws) => { if (!sent.includes(ws.id)) ws.send(JSON.stringify({ type, data })); }); }; @@ -58,7 +58,7 @@ let track = async (ws, token) => { const existing = Object.keys(store.sockets[uid]); if (existing.length > 4) { - const p = existing.find(sid => sid !== uid); + const p = existing.find((sid) => sid !== uid); store.sockets[uid][p].close(code, "too many sockets"); } @@ -72,7 +72,7 @@ export async function socketServer(app) { app.get("/ws", { websocket: true }, (connection, req) => { let { socket: ws } = connection; - connection.on("error", e => err(e.message)); + connection.on("error", (e) => err(e.message)); const id = v4(); ws.id = id; @@ -80,7 +80,7 @@ export async function socketServer(app) { ws.send(JSON.stringify({ type: "connected", data: id })); all[id] = ws; - ws.on("message", async message => { + ws.on("message", async (message) => { let type, data; try { @@ -126,9 +126,9 @@ export async function socketServer(app) { } }); - ws.on("error", e => {}); + ws.on("error", (e) => {}); - ws.on("close", function(code, reason) { + ws.on("close", function (code, reason) { try { const uid = users[id]; if (store.sockets[uid] && store.sockets[uid][id]) { |
