EventSources for SSE in services now have a defined lifetime.#1284
EventSources for SSE in services now have a defined lifetime.#1284ArthurPxC wants to merge 2 commits into
Conversation
| this.eventSource.onmessage = this.onReceived.bind(this); | ||
| } | ||
|
|
||
| private clearAll() { |
There was a problem hiding this comment.
Please check #1282 for the conflict here and the fix i made there and combine the changes🙂
There was a problem hiding this comment.
this will be replaced by proper effect handling. using ngOnInit and signals is not a good idea. We already prepared this in pair, @ArthurPxC will push it later.
| url = input('notifications'); | ||
| api = input('/api/moryx/notifications/stream'); | ||
| eventSource: EventSource | undefined; | ||
| eventSource: EventSource | null = null; |
There was a problem hiding this comment.
What is the reason you introduced null here instead of undefined which should be used everywhere else? 🤔
| this.disconnectEvents(); | ||
| } | ||
|
|
||
| @HostListener('window:beforeunload') |
There was a problem hiding this comment.
use component metadate instead of annotation
| @HostListener('window:beforeunload') | ||
| onBeforeUnload() { | ||
| this._processHolderStreamService.disconnect(); | ||
| } |
|
|
||
|
|
| this.eventSource.onmessage = this.onReceived.bind(this); | ||
| } | ||
|
|
||
| private clearAll() { |
There was a problem hiding this comment.
this will be replaced by proper effect handling. using ngOnInit and signals is not a good idea. We already prepared this in pair, @ArthurPxC will push it later.
Changes made for "EventSources in Web projects are not closed correctly #1255"