#Creating and passing an IPC channel in Rust and using it in the frontend

2 messages · Page 1 of 1 (latest)

opal briar
#

I'm trying to create a Channel on the backend and then pass it to the frontend as the result of a command, per this comment
https://github.com/tauri-apps/tauri/discussions/12752#discussioncomment-13265257

However, it just gets serialized as a string like __CHANNEL__:0.
Is there an easy way to convert this back into a usable channel in the frontend (ts/js)?

Followup, I had a look at the internals of how the Channel is implemented on the Rust side. Even if there was a way to reconstruct the channel from the ID, would I have to create with custom logic like in
https://github.com/tauri-apps/tauri/blob/152d971bcd6c1fdc5716f7d5417dd4df5ce7479f/crates/tauri/src/ipc/channel.rs#L133
or use that type directly?

GitHub

Build smaller, faster, and more secure desktop and mobile applications with a web frontend. - tauri-apps/tauri

GitHub

There seems to be a few approaches I've found to send large data from rust to js. Channels Custom uri scheme protocol ipc::Response (as recommended here) However they're not exactly well do...

restive zinc
#

Is there an easy way to convert this back into a usable channel in the frontend (ts/js)?
No, just like about there being a send() method on the js side i was wrong about that too in the discussion.