[Gambas-user] Desktop-App with embedded Web-Interface

T Lee Davidson t.lee.davidson at gmail.com
Wed Dec 21 16:25:18 CET 2022


On 12/21/22 08:45, Claus Dietrich wrote:
> As the title says, the web-interface is shall be embedded. This means, that the desktop app shall provide some kind of micro 
> service. A web-server environment like Apache shall not be applied. A remote device shall be anything within the local network 
> (tablet, smartphone, PC) which has a web browser (used as client). The web browser shall display a button and a click on the 
> button shall send a signal readable by the desktop app. That means that the desktop app shall partially be remote controllable 
> via a browser.
> 
> Hope that this makes it clearer.
> 
> Regards
> Claus

Yes, that does make it more clear. Thank you.

There are quite a few times I have wished that Gambas had an embeddable, basic web server. As far as I know, gb.httpd can be 
used only in the IDE. It is based on thttpd [1] and, I assume, heavily customized for that purpose.

Websockets are very useful for remote control applications as they behave more peer-to-peer than client-server. But, alas, we 
don't yet have a websocket server either.

All I can suggest is that you code up a crude HTTP server on top of SocketServer. You can parse the request from the client. And 
then, based on the URL and/or Query String in the request, take appropriate action in the desktop app and emit HTTP/HTML 
responses back to the client indicating current state of control. For examples of HTTP requests and responses see:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Session

I don't have time at the moment to code up a simple example, but maybe this is enough to get you started.


-- 
Lee

[1] http://www.acme.com/software/thttpd/



More information about the User mailing list