mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 18:41:14 +00:00
refactor(core): Refactor WorkflowStatistics code (no-changelog) (#6617)
refactor(core): Refactor WorkflowStatistics code
This commit is contained in:
committed by
GitHub
parent
e7091d6726
commit
f4a18ba87d
@@ -1,3 +1,4 @@
|
||||
import { EventEmitter } from 'events';
|
||||
import { ServerResponse } from 'http';
|
||||
import type { Server } from 'http';
|
||||
import type { Socket } from 'net';
|
||||
@@ -16,7 +17,7 @@ import type { IPushDataType } from '@/Interfaces';
|
||||
const useWebSockets = config.getEnv('push.backend') === 'websocket';
|
||||
|
||||
@Service()
|
||||
export class Push {
|
||||
export class Push extends EventEmitter {
|
||||
private backend = useWebSockets ? new WebSocketPush() : new SSEPush();
|
||||
|
||||
handleRequest(req: SSEPushRequest | WebSocketPushRequest, res: PushResponse) {
|
||||
@@ -27,6 +28,7 @@ export class Push {
|
||||
} else {
|
||||
res.status(401).send('Unauthorized');
|
||||
}
|
||||
this.emit('editorUiConnected', req.query.sessionId);
|
||||
}
|
||||
|
||||
send<D>(type: IPushDataType, data: D, sessionId: string | undefined = undefined) {
|
||||
|
||||
Reference in New Issue
Block a user