diff options
| author | ha-dai <contact@haradai.net> | 2017-11-02 13:58:47 +0900 |
|---|---|---|
| committer | ha-dai <contact@haradai.net> | 2017-11-02 13:58:47 +0900 |
| commit | 4e83106853e1da2ff7f5b3dabe23c3791c25f289 (patch) | |
| tree | 1fb73d608bfe65ad9274477fc2b99822d36bf76f /src/api/streaming.ts | |
| parent | Merge branch 'master' of https://github.com/syuilo/misskey (diff) | |
| parent | Refactor (diff) | |
| download | misskey-4e83106853e1da2ff7f5b3dabe23c3791c25f289.tar.gz misskey-4e83106853e1da2ff7f5b3dabe23c3791c25f289.tar.bz2 misskey-4e83106853e1da2ff7f5b3dabe23c3791c25f289.zip | |
Merge branch 'master' of https://github.com/syuilo/misskey
Diffstat (limited to 'src/api/streaming.ts')
| -rw-r--r-- | src/api/streaming.ts | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/api/streaming.ts b/src/api/streaming.ts index db600013b9..0e512fb210 100644 --- a/src/api/streaming.ts +++ b/src/api/streaming.ts @@ -9,6 +9,7 @@ import isNativeToken from './common/is-native-token'; import homeStream from './stream/home'; import messagingStream from './stream/messaging'; import serverStream from './stream/server'; +import channelStream from './stream/channel'; module.exports = (server: http.Server) => { /** @@ -26,14 +27,6 @@ module.exports = (server: http.Server) => { return; } - const user = await authenticate(request.resourceURL.query.i); - - if (user == null) { - connection.send('authentication-failed'); - connection.close(); - return; - } - // Connect to Redis const subscriber = redis.createClient( config.redis.port, config.redis.host); @@ -43,6 +36,19 @@ module.exports = (server: http.Server) => { subscriber.quit(); }); + if (request.resourceURL.pathname === '/channel') { + channelStream(request, connection, subscriber); + return; + } + + const user = await authenticate(request.resourceURL.query.i); + + if (user == null) { + connection.send('authentication-failed'); + connection.close(); + return; + } + const channel = request.resourceURL.pathname === '/' ? homeStream : request.resourceURL.pathname === '/messaging' ? messagingStream : |