From 161fd4afab323ca6bf491def473f84bb7557b481 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 7 Mar 2018 17:48:32 +0900 Subject: wip --- src/api/stream/othello.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/api/stream/othello.ts (limited to 'src/api/stream/othello.ts') diff --git a/src/api/stream/othello.ts b/src/api/stream/othello.ts new file mode 100644 index 0000000000..5056eb535c --- /dev/null +++ b/src/api/stream/othello.ts @@ -0,0 +1,10 @@ +import * as websocket from 'websocket'; +import * as redis from 'redis'; + +export default function(request: websocket.request, connection: websocket.connection, subscriber: redis.RedisClient, user: any): void { + // Subscribe othello stream + subscriber.subscribe(`misskey:othello-stream:${user._id}`); + subscriber.on('message', (_, data) => { + connection.send(data); + }); +} -- cgit v1.2.3-freya