Skip to content

Commit

Permalink
feat: emit stream events in stream_connection.ts
Browse files Browse the repository at this point in the history
* feat: emit stream events in stream_connection.ts (#529)
  • Loading branch information
Chris Watts authored and CJxD committed Nov 25, 2024
1 parent f1d6c28 commit 40a5bed
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/managedwriter/stream_connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,15 @@ export class StreamConnection extends EventEmitter {
});
this._connection.on('pause', () => {
this.trace('connection paused');
this.emit('pause');
});
this._connection.on('resume', () => {
this.trace('connection resumed');
this.emit('resume');
});
this._connection.on('end', () => {
this.trace('connection ended');
this.emit('end');
});
}

Expand Down Expand Up @@ -364,6 +367,7 @@ export class StreamConnection extends EventEmitter {
);
this.close();
this.open();
this.emit('reconnect');
}

/**
Expand All @@ -375,6 +379,7 @@ export class StreamConnection extends EventEmitter {
}
this._connection.end();
this._connection.removeAllListeners();
this.emit('close');
this._connection.destroy();
this._connection = null;
}
Expand Down

0 comments on commit 40a5bed

Please sign in to comment.