summaryrefslogtreecommitdiff
path: root/src/api/stream
diff options
context:
space:
mode:
authorこぴなたみぽ <Syuilotan@yahoo.co.jp>2017-11-06 19:05:44 +0900
committerGitHub <noreply@github.com>2017-11-06 19:05:44 +0900
commit04bdc5df405479e94ab5117a0a39005cfe385556 (patch)
treed27280152bdad0bd323f238f06f5a356e5141c31 /src/api/stream
parentchore(package): update @types/webpack to version 3.0.14 (diff)
parentMerge pull request #845 from syuilo/greenkeeper/@types/gulp-4.0.5 (diff)
downloadmisskey-04bdc5df405479e94ab5117a0a39005cfe385556.tar.gz
misskey-04bdc5df405479e94ab5117a0a39005cfe385556.tar.bz2
misskey-04bdc5df405479e94ab5117a0a39005cfe385556.zip
Merge branch 'master' into greenkeeper/@types/webpack-3.0.14
Diffstat (limited to 'src/api/stream')
-rw-r--r--src/api/stream/channel.ts12
-rw-r--r--src/api/stream/home.ts6
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;