diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-05-24 20:50:17 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-05-24 20:50:17 +0900 |
| commit | caeba1197c4b66e10614ffbddce0a2e98b0b5ef3 (patch) | |
| tree | 929fbbcc92b9e24baa203fdb2e025f9e3e7e94f0 /src/api/event.ts | |
| parent | Use tabs in json (diff) | |
| download | sharkey-caeba1197c4b66e10614ffbddce0a2e98b0b5ef3.tar.gz sharkey-caeba1197c4b66e10614ffbddce0a2e98b0b5ef3.tar.bz2 sharkey-caeba1197c4b66e10614ffbddce0a2e98b0b5ef3.zip | |
Refactoring
Diffstat (limited to 'src/api/event.ts')
| -rw-r--r-- | src/api/event.ts | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/api/event.ts b/src/api/event.ts index 39dc809bdc..9613a9f7cc 100644 --- a/src/api/event.ts +++ b/src/api/event.ts @@ -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(); |