egirlskey/src/api/stream/othello.ts

11 lines
372 B
TypeScript
Raw Normal View History

2018-03-07 02:40:40 +00:00
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 {
2018-03-07 08:48:32 +00:00
// Subscribe othello stream
subscriber.subscribe(`misskey:othello-stream:${user._id}`);
2018-03-07 02:40:40 +00:00
subscriber.on('message', (_, data) => {
connection.send(data);
});
}