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

Claus Dietrich claus.dietrich at freenet.de
Wed Dec 21 17:46:50 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
Thanks! Hans just sent me a Gambas project from Olivier Coquet which does exactly what
you suggest and it worked right away. The HTTP server is realized by a class and the
web-interface provides a button - couldn't be better.

Best regards
Claus

   



More information about the User mailing list