diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2019-04-13 19:19:32 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2019-04-13 19:19:32 +0900 |
| commit | e369031a28a7aae390d17d4d9f075c6f0df7fe55 (patch) | |
| tree | 4e0410685973c47b9c311f8a3ebf212310c9b701 /src/server/api/streaming.ts | |
| parent | Fix bug (diff) | |
| download | misskey-e369031a28a7aae390d17d4d9f075c6f0df7fe55.tar.gz misskey-e369031a28a7aae390d17d4d9f075c6f0df7fe55.tar.bz2 misskey-e369031a28a7aae390d17d4d9f075c6f0df7fe55.zip | |
Redis必須に
Diffstat (limited to 'src/server/api/streaming.ts')
| -rw-r--r-- | src/server/api/streaming.ts | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/src/server/api/streaming.ts b/src/server/api/streaming.ts index ab66f2b6d9..902c62ef98 100644 --- a/src/server/api/streaming.ts +++ b/src/server/api/streaming.ts @@ -1,7 +1,6 @@ import * as http from 'http'; import * as websocket from 'websocket'; import * as redis from 'redis'; -import Xev from 'xev'; import MainStreamConnection from './stream'; import { ParsedUrlQuery } from 'querystring'; @@ -23,28 +22,24 @@ module.exports = (server: http.Server) => { let ev: EventEmitter; - if (config.redis) { - // Connect to Redis - const subscriber = redis.createClient( - config.redis.port, config.redis.host); + // Connect to Redis + const subscriber = redis.createClient( + config.redis.port, config.redis.host); - subscriber.subscribe('misskey'); + subscriber.subscribe('misskey'); - ev = new EventEmitter(); + ev = new EventEmitter(); - subscriber.on('message', async (_, data) => { - const obj = JSON.parse(data); + subscriber.on('message', async (_, data) => { + const obj = JSON.parse(data); - ev.emit(obj.channel, obj.message); - }); + ev.emit(obj.channel, obj.message); + }); - connection.once('close', () => { - subscriber.unsubscribe(); - subscriber.quit(); - }); - } else { - ev = new Xev(); - } + connection.once('close', () => { + subscriber.unsubscribe(); + subscriber.quit(); + }); const main = new MainStreamConnection(connection, ev, user, app); |