Closed codesplode closed 6 months ago
Why would you want to implement the protocol without using the C library? How will you start the browser, manage profiles etc? The protocol is nothing fancy, why use this one? Or you want to use just webui.js
+ your own backend?
Hey @codesplode, Welcome. What @fibodevy wants to say is that you don't need to deal with the binary communication protocol between our JVM backend and the frontend. Instead, you only need to use Java JNI to load the pre-compiled WebUI dynamic library .dll
, .dynlib
, .so
, and start using it directly.
To create a new JVM wrapper, you have to wrap every WebUI C APIs, example (this is quick and untested):
public class WebUI {
// Native (C) functions
public native void webui_exit();
// Load the library
static {
System.loadLibrary("webui-2");
}
public static void main(String[] args) {
WebUI webui = new WebUI();
// Call the C function
WebUI.webui_exit();
}
}
Thanks so much for the quick response!
I haven't had great luck or performance with JNI in the past, but that's mostly due to attempting it with much more complex libraries. I'll definitely give that a go and I can probably write a script to generate the wrapper.
Side request: If anyone has a script already to do this binding in another language I'd appreciate pointing me to it, but I should be able to solve that with the header file.
Thank you @fibodevy and @hassandraga ! I'll share the results if all goes well!
Closing this issue for now so it is no longer in the open list as I have what I need to move forward.
Hi there and thank you for an awesome project!
I'm interested in using this project with a JVM backend and would like more information about the websocket / binary protocol the backend needs to implement to accomplish this.
Looking at the other wrapper it seems implementing this is the primary challenge to making a wrapper for the JVM, which seems like it should not be a very hard task with a good understanding of the protocol.
Could you point me in the right direction on any documentation for it? I didn't find any after going through the documentation, examples, and wrapper repositories, so it looks like digging in the C source may be the only possibility remaining, but I'm concerned about missing something doing that as I do not work in C all the time.
Thank you!