yumechi-no-kuni/src/server/api/stream/messaging-index.ts

10 lines
334 B
TypeScript
Raw Normal View History

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