diff options
| author | こぴなたみぽ <Syuilotan@yahoo.co.jp> | 2017-11-06 19:09:41 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-11-06 19:09:41 +0900 |
| commit | 2099f494d7662a9298c6b3d9d2fe5488872f8ae1 (patch) | |
| tree | d552a0b58a07b82e842715f4dbd22380ae0007be /src/api/stream | |
| parent | chore(package): update @types/multer to version 1.3.5 (diff) | |
| parent | Merge pull request #710 from syuilo/greenkeeper/@types/bcryptjs-2.4.1 (diff) | |
| download | misskey-2099f494d7662a9298c6b3d9d2fe5488872f8ae1.tar.gz misskey-2099f494d7662a9298c6b3d9d2fe5488872f8ae1.tar.bz2 misskey-2099f494d7662a9298c6b3d9d2fe5488872f8ae1.zip | |
Merge branch 'master' into greenkeeper/@types/multer-1.3.5
Diffstat (limited to 'src/api/stream')
| -rw-r--r-- | src/api/stream/channel.ts | 12 | ||||
| -rw-r--r-- | src/api/stream/home.ts | 6 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/api/stream/channel.ts b/src/api/stream/channel.ts new file mode 100644 index 0000000000..d67d77cbf4 --- /dev/null +++ b/src/api/stream/channel.ts @@ -0,0 +1,12 @@ +import * as websocket from 'websocket'; +import * as redis from 'redis'; + +export default function(request: websocket.request, connection: websocket.connection, subscriber: redis.RedisClient): void { + const channel = request.resourceURL.query.channel; + + // Subscribe channel stream + subscriber.subscribe(`misskey:channel-stream:${channel}`); + subscriber.on('message', (_, data) => { + connection.send(data); + }); +} diff --git a/src/api/stream/home.ts b/src/api/stream/home.ts index d5fe01c261..7c8f3bfec8 100644 --- a/src/api/stream/home.ts +++ b/src/api/stream/home.ts @@ -4,6 +4,7 @@ import * as debug from 'debug'; import User from '../models/user'; import serializePost from '../serializers/post'; +import readNotification from '../common/read-notification'; const log = debug('misskey'); @@ -45,6 +46,11 @@ export default function homeStream(request: websocket.request, connection: webso }); break; + case 'read_notification': + if (!msg.id) return; + readNotification(user._id, msg.id); + break; + case 'capture': if (!msg.id) return; const postId = msg.id; |