-
Notifications
You must be signed in to change notification settings - Fork 959
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
Detour on_message #1147
Comments
Hello! First, can you please explain your use case and why the current implemention doesn't work for you? |
The usage of Promises in the view space is troublesome for me for messaging, because I run wasm without ASYNCIFY in my view and I decided to go back to a |
If I understand correctly, there's a way for you to solve the issue without modifying the library, but you want to invoke a bound function (send a message to the C++ side) directly from WASM, and awaiting the promise is problematic? I'm not very familiar with WASM so I might need some more help with understanding the problem. I'm not yet entirely convinced that the webview library should allow users to hijack the internal message handler. I don't think we'll want to make any guarantees that promises won't be used elsewhere in a way that can reintroduce the problem for you in some way, and I doubt we can provide customization points whenever that happens. An idea that could potentially make sense anyway is to allow registering custom message handlers. That way I imagine you could send and handle arbitrary messages. Even so, I'm not convinced that we would want to guarantee a promise-free use case here. Can you think of a better way to solve the problem? Thanks. |
I could have also possibly just replaced the view js part and kept the message handler the same I think, but I decided against it, so that I dont have to adhere to the format from webview and so I can just parse the json once in my detour function. Basically what I need(ed?) is that the browser communication is 2 layered: a stupid way that just wraps the browser APIs which I can use to implement my boilerplate message dispatching myself and then the convenience layer provided by webview itself (that does message dispatching). EDIT: which only concernes the receiving side because sending into the view is possible. Receiving arbitrarily is not. Thats why i called this issue as is. |
I need to detour/hook on_message, because my use case does not work with the default implementation.
I have been doing this on a fork for some time: 3528e6a
(linked commit is on old version of the library)
I just want to know if I can contribute this in some shape or form, so I can get rid of my fork.
The text was updated successfully, but these errors were encountered: