summaryrefslogtreecommitdiff
path: root/src/api/stream/messaging-index.ts
blob: c1b2fbc806f1722c387523f39dd2974afac48108 (plain)
1
2
3
4
5
6
7
8
9
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 messaging index stream
	subscriber.subscribe(`misskey:messaging-index-stream:${user._id}`);
	subscriber.on('message', (_, data) => {
		connection.send(data);
	});
}