You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi all, I'm working on a project where I'm passing files to a Node.js/Puppeteer sidecar from a Tauri Webview and receiving periodic updates via STDIN/O. The general flow looks something like this:
Tauri Webview
// example of receiving variable from sidecarcomm.stdout.on("data",(line)=>{console.log(`command stdout: "${line}"`);if(line.includes("uniquePuppeteerID~!@")){handleIssueAssignment(line);return;}additionalLogs=autoRes+"<br>"+additionalLogs;autoRes=line;});// example of logging errors from sidecarletsidecarErr=0comm.stderr.on("data",(line)=>{console.log(`command stderr: "${line}"`);sidecarErr++;errorLogs=errorLogs+"<br>"+line;});// tell the process to close and cleanup puppeteer processgetCurrentWindow().listen('tauri://close-requested',async()=>{childBinary.write("close");awaitgetCurrentWindow().destroy();})
Puppeteer Sidecar
// example of sending a variable back to webviewconsole.log("uniquePuppeteerID~!@VariableIdentifier~!@"+JSON.stringify(variable))// handling close from webviewprocess.stdin.on('data',async(data)=>{if(data.toString()=="close"){awaitbrowser.close();process.exit(0);}})
This works great, but I'm thinking about a couple things:
How hard would it be to send a "close" to the sidecar's STDIN from somewhere other than webview? Is this a potential security risk?
Would it be safer and cleaner to use something like WebSocket to handle this sort of communication?
Alternatively is there a standard Tauri way to communicate between a sidecar and WebView?
Could I possibly eliminate the need for a sidecar? Have people found success in puppeteer alternatives for Rust?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all, I'm working on a project where I'm passing files to a Node.js/Puppeteer sidecar from a Tauri Webview and receiving periodic updates via STDIN/O. The general flow looks something like this:
Tauri Webview
Puppeteer Sidecar
This works great, but I'm thinking about a couple things:
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions