Replies: 1 comment 2 replies
-
It all depends on your project's needs and the running environment. If you are developing a production web application for your users, it is better to use PHP on the backend to handle cookies and other server-side tasks, along with a sophisticated web server like Apache or NGINX. Instead of asking users to run commands and copy-paste a URL into their browser, you can use WebUI with something like custom_web_server to provide an executable that starts the server and automatically opens a window pointing to your PHP server. If you want to leverage WebUI’s capabilities beyond simply opening a browser window, you can also try php-webui-composer. With this approach, instead of relying on traditional Alternatively, you can fully implement user management, cookie handling, and other features directly with WebUI. However, WebUI is still under active development. Whichever path you choose, we are here to answer any questions you have, and we are also open to implementing new features if they align with WebUI’s general goal: WebUI is not a framework, but a library that uses the web browser as a GUI. |
Beta Was this translation helpful? Give feedback.
-
I have a working GTK application at the moment, but it doesn't quite satisfy the users' needs (you know, it's 2025, everyone has a phone instead of a laptop). I'm thinking about writing a new version of this application as a web application that would run on my PC and be usable via browser by anyone with a phone.
WebUI seems usable for this (i did see the recent addition of multi-user capabilities). However, i have zero webdev experience, and it's kind of difficult for me to wrap my head around the way this thing should work.
I mean, for example, there's a
webui_start_server (win, "index.html");
call that displays the initial window. Which would probably be a login window for me. Say, the user authenticated successfully (i think i figured out how to use cookies to store authentication info in the user's browser), what's next? I need to change the window contents to the initial state of the application UI (it has multiple states that it flips between). Do i need to create and show a new window with something other than index.html as its content? Would that window be working on a different port (i can live with multiple open ports, one per window, as long as there's a limited number of windows (i would have about 5 or 7, maybe), each of which can serve any number of users)? If so, what would prevent users from accessing it directly and bypassing the initial login window? Would i have to check and re-check for authentication cookies every time an event happens in a window, or only once (when a window gets aWEBUI_EVENT_CONNECTED
)?Also, so far i have seen no mention of threads. Does that mean that WebUI is single-threaded (it's OK if it is, i just need to know)?
And does that mean that every event a window gets might be associated with a different user-session, meaning that every event handler should start with a piece of code that grabs the connection state somehow (again, cookies? or a way to attach a pointer to a user-session somehow) and figures out which user-session this event belongs to, to ensure that it's processed correctly?
I see that
webui_event_t
hasbind_id
,client_id
andconnection_id
, but there doesn't seem to be a lot of documentation about these fields.client_id
looks like a uint, and the multi-user example app uses it as an index in an array (what happens when one client drops and a new one connects? Areclient_id
s always sequential? Are they recycled? How do i know that the ID was recycled?). From the example i surmise thatclient_id
is automatically kept via cookies and identifies one browser (theoretically, you can open a new private tab without cookies and that would count you as a new client), whileconnection_id
refers to a particular tab in that browser (useless for my purposes; it's like allowing you desktop app to be launched in multiple instances, which my existing app does not; i'll be content with every new connection displaying the same user-session state, or, even better, with only one (the newest) connection actually working).Also, there's no examples on how to work with cookies (multi-user example doesn't actually use the
cookies
variable).Should i keep digging in this direction, or would it be easier for me to just go and learn php/whatever and how to do web development?
Beta Was this translation helpful? Give feedback.
All reactions