diff --git a/src/index.ts b/src/index.ts index ed9ff03..2737c2a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -330,6 +330,11 @@ async function main() { process.exit(0) } + // Exit when the client disconnects (transport closes) + transport.onclose = () => { + shutdown() + } + process.on('SIGINT', shutdown) process.on('SIGTERM', shutdown) }