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

10 lines
314 B
TypeScript
Raw Normal View History

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