Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

binary support #3212

Open
snopywithchary opened this issue Jan 20, 2024 · 9 comments
Open

binary support #3212

snopywithchary opened this issue Jan 20, 2024 · 9 comments
Labels
Enhancement New feature or request

Comments

@snopywithchary
Copy link

Is your feature request related to a problem? Please describe.

I use wails to transmit binary image streams, but I found that if I bind the method of transmitting binary, wails will automatically base64 encode the binary. Is there a more efficient method?

Describe the solution you'd like

such as this: https://github.com/MicrosoftEdge/WebView2Feedback/blob/main/specs/SharedBuffer.md

Describe alternatives you've considered

No response

Additional context

No response

@snopywithchary snopywithchary added the Enhancement New feature or request label Jan 20, 2024
@leaanthony
Copy link
Member

Without knowing your use case, I can only suggest https://wails.io/docs/guides/dynamic-assets/

@snopywithchary
Copy link
Author

Without knowing your use case, I can only suggest https://wails.io/docs/guides/dynamic-assets/
I have a video, the backend reads the video and sends the image data to the frontend for rendering, I am currently using websocket transport because I didn't find a more efficient transport method in wails

@afocus
Copy link

afocus commented Jan 24, 2024

There are certain scenarios where json encoding and decoding is costly, such as photoshop and video editing software. While the use of binary with Uint8Array in websockets can temporarily handle this, it would be nice to have binary support built into the binding.

@leaanthony
Copy link
Member

SharedBuffer would be good. What about Mac and Linux though?

@stffabi
Copy link
Collaborator

stffabi commented Jan 25, 2024

SharedBuffer would be good. What about Mac and Linux though?

There are no such things on those platforms. The only thing that works there is streaming responses through the AssetServer as you already mentioned (https://wails.io/docs/guides/dynamic-assets/)

@stffabi
Copy link
Collaborator

stffabi commented Jan 25, 2024

I have a video, the backend reads the video and sends the image data to the frontend for rendering, I am currently using websocket transport because I didn't find a more efficient transport method in wails

Please be aware, Websockets don't work over the custom scheme used in-app, unless you are starting your own http server on the network stack.

@gedw99
Copy link

gedw99 commented Feb 2, 2024

@stffabi

Would be awesome if sockets were used for the IO between the Backend and Frontend.

Pushup does it this way for golang htmx projects.

https://github.com/adhocteam/pushup/blob/main/_runtime/cmd/main.go#L29

@stffabi
Copy link
Collaborator

stffabi commented Feb 16, 2024

@gedw99 Opening unix sockets or ports on the network stack is probably not a feature people want to see in a default Wails app. That would allow to intercept traffic from backend/frontend relatively easy, that's why the AssetServer is not bound to the network stack and uses IPC.

But if someone wants to do that, that is pretty easily doable with just a couple of lines in Go to start a http server and use that in your frontend.

@KiddoV
Copy link
Contributor

KiddoV commented May 16, 2024

Any update on this one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants