2018-04-26 04:02:15 +02:00
|
|
|
import * as websocket from 'websocket';
|
2018-07-30 00:20:27 +02:00
|
|
|
import Xev from 'xev';
|
2018-04-26 04:02:15 +02:00
|
|
|
import { ParsedUrlQuery } from 'querystring';
|
|
|
|
|
2018-07-30 00:20:27 +02:00
|
|
|
export default function(request: websocket.request, connection: websocket.connection, subscriber: Xev, user: any): void {
|
2018-04-26 04:02:15 +02:00
|
|
|
const q = request.resourceURL.query as ParsedUrlQuery;
|
|
|
|
const listId = q.listId as string;
|
|
|
|
|
|
|
|
// Subscribe stream
|
2018-07-30 00:20:27 +02:00
|
|
|
subscriber.on(`user-list-stream:${listId}`, data => {
|
2018-08-01 04:07:30 +02:00
|
|
|
connection.send(JSON.stringify(data));
|
2018-04-26 04:02:15 +02:00
|
|
|
});
|
|
|
|
}
|