How to be notified when webui is connected #294
-
Calling webui before its websocket is connected result in an error "Error: WebSocket is not connected" |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 10 replies
-
In the backend, using C/C++ for example, you can bind a blank empty ID to get all events, example: // All events
void events(webui_event_t* e) {
if (e->event_type == WEBUI_EVENT_CONNECTED) // <- - - - -
printf("Connected. \n");
else if (e->event_type == WEBUI_EVENT_DISCONNECTED)
printf("Disconnected. \n");
else if (e->event_type == WEBUI_EVENT_MOUSE_CLICK)
printf("Click. \n");
else if (e->event_type == WEBUI_EVENT_NAVIGATION) {
const char* url = webui_get_string(e);
printf("Starting navigation to: %s \n", url);
webui_navigate(e->window, url);
}
}
// Bind all events by using an empty ID
webui_bind(MyWindow, "", events); In the frontend, I guess this option does not exist yet! |
Beta Was this translation helpful? Give feedback.
-
Thank you !
I have cloned the github repo.
I 'am (exceptionally) working on windows. In a msys2 windows I launched
the command mingw32-make.exe
and the directory dist has been created with the dll and lib files.
I also included the piece of code you sent me in my js ui.
My backend is written in python.
At this point I don't know how to test the new version, keeping in
place the old one.
Thank you for any advice !
Le 04/01/2024 21:29, Hassan DRAGA a écrit :
… We both noticed that in the same exact moment!
However, I'm going to add this feature today.
Thanks again for the idea.
--
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
In the backend, using C/C++ for example, you can bind a blank empty ID to get all events, example:
In the frontend, I guess this option does not exist …