feat: helper method to emit screenshot to client via websocket

This commit is contained in:
karishmas6
2024-06-01 11:01:12 +05:30
parent 580e0c046a
commit 30cab6c5b2

View File

@@ -204,4 +204,14 @@ export class RemoteBrowser {
this.interpreter?.updateSocket(socket);
};
/**
* Helper for emitting the screenshot of browser's active page through websocket.
* @param payload the screenshot binary data
* @returns void
*/
private emitScreenshot = (payload: any) : void => {
const dataWithMimeType = ('data:image/jpeg;base64,').concat(payload);
this.socket.emit('screencast', dataWithMimeType);
logger.log('debug',`Screenshot emitted`);
};
}