Skip to content

Commit

Permalink
feat: Close writable stream too when it's closed
Browse files Browse the repository at this point in the history
  • Loading branch information
gnarea committed Jul 28, 2021
1 parent 979bd77 commit 95bf3f3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/MockWebSocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ export class MockWebSocket extends EventEmitter {

this.on('message', (message) => duplex.push(message));

this.on('close', () => duplex.push(null));
this.once('close', () => duplex.destroy());

this.on('error', (error) => duplex.destroy(error));
this.once('error', (error) => duplex.destroy(error));

return duplex;
}
Expand Down

0 comments on commit 95bf3f3

Please sign in to comment.