1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-12-21 18:18:25 +09:00
misskey/src/server/api/stream/user-list.ts
2018-04-26 11:02:15 +09:00

15 lines
503 B
TypeScript

import * as websocket from 'websocket';
import * as redis from 'redis';
import { ParsedUrlQuery } from 'querystring';
export default function(request: websocket.request, connection: websocket.connection, subscriber: redis.RedisClient, user: any): void {
const q = request.resourceURL.query as ParsedUrlQuery;
const listId = q.listId as string;
// Subscribe stream
subscriber.subscribe(`misskey:user-list-stream:${listId}`);
subscriber.on('message', (_, data) => {
connection.send(data);
});
}