diff options
| author | Adam Soltys <[email protected]> | 2023-01-17 11:53:24 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-01-17 11:53:24 -0800 |
| commit | e918a818acf789a6619cbf4432f0c4713d4c53e6 (patch) | |
| tree | 0d30f8b6e519aaf31079f337e8808992f63f92ef /lib/sockets.js | |
| parent | 46913d34e77f19c3dd7c105b1deec452348dd1db (diff) | |
| download | coinos-server-e918a818acf789a6619cbf4432f0c4713d4c53e6.tar.gz coinos-server-e918a818acf789a6619cbf4432f0c4713d4c53e6.zip | |
nostr cleanup
Diffstat (limited to 'lib/sockets.js')
| -rw-r--r-- | lib/sockets.js | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/sockets.js b/lib/sockets.js index 7f655570..e803d5b0 100644 --- a/lib/sockets.js +++ b/lib/sockets.js @@ -47,7 +47,6 @@ export const broadcast = (type, data) => { }); }; - export async function socketServer(app) { let seconds = (n, d = new Date()) => d.setSeconds(d.getSeconds() - n) && d; @@ -90,9 +89,7 @@ export async function socketServer(app) { const existing = Object.keys(store.sockets[uid]); if (existing.length > 4) { const p = existing.find(sid => sid !== uid); - store.sockets[uid][p].send( - JSON.stringify({ type: "logout" }) - ); + store.sockets[uid][p].send(JSON.stringify({ type: "logout" })); setTimeout(() => { if (store.sockets[uid][p]) store.sockets[uid][p].close(code, "too many sockets"); @@ -149,7 +146,6 @@ export async function socketServer(app) { }); } - export let sendHeartbeat = () => { for (const uid in store.sockets) { for (const id in store.sockets[uid]) { @@ -158,4 +154,4 @@ export let sendHeartbeat = () => { if (ws.beats > 10) ws.close(code, `${uid} ${id} lost heartbeat`); } } -} +}; |
