diff options
| author | Adam Soltys <[email protected]> | 2023-04-06 15:25:07 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-04-06 15:25:07 -0700 |
| commit | 99b72e143866d5cc62ba04847885070dc9a5c645 (patch) | |
| tree | abda08ae881b6e9bfff2ebbcf58d1409d7395fcf /lib/sockets.js | |
| parent | 5083648dc113547c1c604e0c93ed0ee961f01ea3 (diff) | |
| download | coinos-server-99b72e143866d5cc62ba04847885070dc9a5c645.tar.gz coinos-server-99b72e143866d5cc62ba04847885070dc9a5c645.zip | |
prettier
Diffstat (limited to 'lib/sockets.js')
| -rw-r--r-- | lib/sockets.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/sockets.js b/lib/sockets.js index 55cd642e..458c77a9 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 })); }); }; @@ -56,7 +56,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 { ({ type, data } = JSON.parse(message)); @@ -87,7 +87,7 @@ export async function socketServer(app) { if (!store.sockets[uid]) store.sockets[uid] = {}; 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].send(JSON.stringify({ type: "logout" })); setTimeout(() => { if (store.sockets[uid][p]) @@ -132,7 +132,7 @@ export async function socketServer(app) { ws.on("error", console.log); - 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]) { |
