diff options
Diffstat (limited to 'lib/sockets.ts')
| -rw-r--r-- | lib/sockets.ts | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/lib/sockets.ts b/lib/sockets.ts index 2e1c98e9..88817728 100644 --- a/lib/sockets.ts +++ b/lib/sockets.ts @@ -120,12 +120,8 @@ Bun.serve({ await track(ws, data); } catch (e) { - if (e.message.includes("not found")) - ws.send(JSON.stringify({ type: "logout" })); - setTimeout( - () => ws?.close(code, `closing due to error ${e.message}`), - 1000, - ); + if (e.message.includes("not found")) ws.send(JSON.stringify({ type: "logout" })); + setTimeout(() => ws?.close(code, `closing due to error ${e.message}`), 1000); } break; case "token": @@ -139,7 +135,7 @@ Bun.serve({ subscriptions.push({ invoice: data, ws }); break; default: - // warn("received socket message of unknown type", type, data); + // warn("received socket message of unknown type", type, data); } }, open(ws: any) { @@ -158,8 +154,7 @@ Bun.serve({ } let i; - ~(i = subscriptions.findIndex((s) => s.ws.id === id)) && - subscriptions.splice(i, 1); + ~(i = subscriptions.findIndex((s) => s.ws.id === id)) && subscriptions.splice(i, 1); if (all[id]) delete all[id]; } catch (e) { |
