monkeeShark/src/server/api/stream/drive.ts

10 lines
314 B
TypeScript
Raw Normal View History

2017-11-16 14:46:36 +00:00
import * as websocket from 'websocket';
2018-07-29 22:20:27 +00:00
import Xev from 'xev';
2017-11-16 14:46:36 +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-16 14:46:36 +00:00
// Subscribe drive stream
2018-07-29 22:20:27 +00:00
subscriber.on(`drive-stream:${user._id}`, data => {
connection.send(JSON.stringify(data));
2017-11-16 14:46:36 +00:00
});
}