hippofish/src/server/api/stream/messaging-index.ts

10 lines
334 B
TypeScript
Raw Normal View History

2017-11-13 16:54:16 +01:00
import * as websocket from 'websocket';
2018-07-30 00:20:27 +02:00
import Xev from 'xev';
2017-11-13 16:54:16 +01:00
2018-07-30 00:20:27 +02:00
export default function(request: websocket.request, connection: websocket.connection, subscriber: Xev, user: any): void {
2017-11-13 16:54:16 +01:00
// Subscribe messaging index stream
2018-07-30 00:20:27 +02:00
subscriber.on(`messaging-index-stream:${user._id}`, data => {
connection.send(JSON.stringify(data));
2017-11-13 16:54:16 +01:00
});
}