diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-11-01 03:17:14 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-11-01 03:17:14 +0900 |
| commit | f37fb38640a31c4b8865a5562628197ff21f3cce (patch) | |
| tree | c68d1b73aeb8c0c61d6a76ed4577036d4c3c04a5 /src/api/stream | |
| parent | wip (diff) | |
| download | sharkey-f37fb38640a31c4b8865a5562628197ff21f3cce.tar.gz sharkey-f37fb38640a31c4b8865a5562628197ff21f3cce.tar.bz2 sharkey-f37fb38640a31c4b8865a5562628197ff21f3cce.zip | |
wip
Diffstat (limited to 'src/api/stream')
| -rw-r--r-- | src/api/stream/channel.ts | 12 |
1 files changed, 12 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); + }); +} |