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

10 lines
334 B
TypeScript
Raw Normal View History

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