Refactoring
This commit is contained in:
parent
5a3cd80973
commit
caeba1197c
16 changed files with 84 additions and 206 deletions
|
|
@ -13,14 +13,6 @@ class MisskeyEvent {
|
|||
config.redis.port, config.redis.host);
|
||||
}
|
||||
|
||||
private publish(channel: string, type: string, value?: any): void {
|
||||
const message = value == null ?
|
||||
{ type: type } :
|
||||
{ type: type, body: value };
|
||||
|
||||
this.redisClient.publish(`misskey:${channel}`, JSON.stringify(message));
|
||||
}
|
||||
|
||||
public publishUserStream(userId: ID, type: string, value?: any): void {
|
||||
this.publish(`user-stream:${userId}`, type, typeof value === 'undefined' ? null : value);
|
||||
}
|
||||
|
|
@ -32,6 +24,14 @@ class MisskeyEvent {
|
|||
public publishMessagingStream(userId: ID, otherpartyId: ID, type: string, value?: any): void {
|
||||
this.publish(`messaging-stream:${userId}-${otherpartyId}`, type, typeof value === 'undefined' ? null : value);
|
||||
}
|
||||
|
||||
private publish(channel: string, type: string, value?: any): void {
|
||||
const message = value == null ?
|
||||
{ type: type } :
|
||||
{ type: type, body: value };
|
||||
|
||||
this.redisClient.publish(`misskey:${channel}`, JSON.stringify(message));
|
||||
}
|
||||
}
|
||||
|
||||
const ev = new MisskeyEvent();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue