mirror of
https://github.com/samuelthomas2774/nxapi.git
synced 2026-10-23 10:06:55 -05:00
Fix stopping presence monitors with event streams
This commit is contained in:
@@ -604,7 +604,11 @@ export class ZncProxyDiscordPresence extends Loop {
|
||||
}
|
||||
}
|
||||
|
||||
async useEventStream() {
|
||||
events: EventSource | null = null;
|
||||
|
||||
useEventStream() {
|
||||
if (this.events) this.events.close();
|
||||
|
||||
const events = new EventSource(this.eventstream_url ?? this.presence_url, {
|
||||
headers: {
|
||||
'User-Agent': getUserAgent(),
|
||||
@@ -635,6 +639,8 @@ export class ZncProxyDiscordPresence extends Loop {
|
||||
return a ? [...a, ..._listeners.call(events, type, ...args)] : _listeners.call(events, type, ...args);
|
||||
};
|
||||
|
||||
this.events = events;
|
||||
|
||||
events.onopen = event => {
|
||||
debugEventStream('EventSource connected', event);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user