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

IPC summary and evaluation for improvement #767

Closed
wusyong opened this issue Nov 24, 2022 · 3 comments
Closed

IPC summary and evaluation for improvement #767

wusyong opened this issue Nov 24, 2022 · 3 comments

Comments

@wusyong
Copy link
Member

wusyong commented Nov 24, 2022

I would like to create this issue to list current IPC techniques so we don't have to search in the codebase back and forth. And at the same time looking for possible improvement. Because some are blocked by upstream, some are platform-specific solutions, and some could be done already since it's just caused by serialization overhead.

evaluate_script

evaluate_script is an API to run a javascript code for the page. #474 demonstrates current implementation and possible improvement pretty well already.

We could add the callback closure to do some stuff after javascript result. But this still has to serialize into strings. So it remains as a good-to-have feature for me, and I didn't have much time to implement this before.

ipc_handler / postMessage

ipc_handler takes a closure that can be called when javascript call window.ipc.postMessage("insert_message_here");. This only accepts string as parameter. We usually use evaluate_script to return the value but this is also string only.

For parameters, mac and Linux can take different JSValue rather than only strings. But windows can only work receive as string.

For return values, please see the first comment of #454. Mac and Windows have some API to add native objects. We can treat these as return values. Linux doesn't provide such functionality, but in the generated wrapper, run_javascript's callback is called after run_javascript_finish. Perhaps we can write another one with callback first and it creates a JS value, then we call run_javascript_finish with that result value.

custom_protocol / custom URL scheme

custom_protocol is a customized URL handler that work like HTTP. It can receive an HTTP request and return an HTTP response without any remote server. The problem is it's still a little different from ordinary HTTP and sometimes it has subtle issues like secure cookie doesn't work on some platforms etc.

In #667, @JonasKruckenberg tried to evaluate streaming possibility, but on Linux, it's blocked by #666. On Linux, the request of custom protocol can't access body for now.

Others

Webview2 has a specific API for shared buffer. But this seems like webview2 only.

@franz-fletcher
Copy link

Re: SharedBuffer support across platforms see tauri-apps/tauri#6269 (comment) discussing upcoming compatibility for WebKit and WKWebView variants.

@wusyong
Copy link
Member Author

wusyong commented Mar 10, 2023

Adrián Pérez wrote a great post about IPC approach around WPE which also apply to WebkitGTK.
Nothing new method for us, but I feel like there are a few further ideas worth exploring.
https://wpewebkit.org/blog/06-integrating-wpe.html

@wusyong
Copy link
Member Author

wusyong commented Mar 22, 2023

I'll close this because we have some breakthrough in #454. And that issue is specific and it's also the feature I would imagine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants