Skip to content

Commit

Permalink
Listen on socket for close/end events
Browse files Browse the repository at this point in the history
  • Loading branch information
nflaig committed Jul 24, 2023
1 parent d2b7815 commit 2b22d0a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/api/src/beacon/server/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ export function getRoutes(config: ChainForkConfig, api: ServerApi<Api>): ServerR
// In that case the BeaconNode class will call server.close() and end this connection.

// The client may disconnect and we need to clean the subscriptions.
req.raw.once("close", () => resolve());
req.raw.once("end", () => resolve());
req.socket.once("close", () => resolve());
req.socket.once("end", () => resolve());
req.raw.once("error", (err) => {
if ((err as unknown as {code: string}).code === "ECONNRESET") {
return reject(new ErrorAborted());
Expand Down

0 comments on commit 2b22d0a

Please sign in to comment.