perf: 各ストリーミング接続ごとにポーリングしないように

This commit is contained in:
syuilo 2021-03-21 15:14:03 +09:00
parent b6d0d4eb99
commit 8050352ad8
11 changed files with 83 additions and 27 deletions

View file

@ -20,6 +20,10 @@ class Publisher {
}));
}
public publishUserEvent = (userId: User['id'], type: string, value?: any): void => {
this.publish(`user:${userId}`, type, typeof value === 'undefined' ? null : value);
}
public publishBroadcastStream = (type: string, value?: any): void => {
this.publish('broadcast', type, typeof value === 'undefined' ? null : value);
}
@ -84,6 +88,7 @@ const publisher = new Publisher();
export default publisher;
export const publishUserEvent = publisher.publishUserEvent;
export const publishBroadcastStream = publisher.publishBroadcastStream;
export const publishMainStream = publisher.publishMainStream;
export const publishDriveStream = publisher.publishDriveStream;