[Gambas-user] Future of webform component

Benoît Minisini g4mba5 at gmail.com
Mon Dec 30 19:30:12 CET 2019


Hi everyone,

Here is a test project for you. It implements what I want to do for web 
development in Gambas.

At the moment, the 'gb.web.form' component allows you to create web 
application with a GUI-like interface, but it has many problems:

1) It's a CGI script. So the entire GUI object tree must be rebuild at 
each request.

2) The only way to keep information between requests is the session, 
which is stored in an external sqlite database. You have to write custom 
code for handling that.

3) There is no event loop at the server level. I mean, when you open a 
modal message box, it's modal on the client side only. You have to rely 
on custom events to get the result on a modal message, and be careful 
with the implied code logic.

The joined little project implements a CGI script that replaces each 
session by a process daemon.

The process is created the first time a new session is created.

All requests are sent to the session process through a pipe, and the 
response is get from another pipe.

If nothing is received by the session process during 20 seconds, the 
process terminates automatically.

The advantages of that method are:

1) The process is permanent. All information is kept between processes. 
No need to rebuild the GUI object tree, to reopen the database 
connections, and so on...

2) No need to store the session in a database or a file. The process 
memory *is* the session.

3) It will be possible to implement a true event loop in the session 
process. Modal dialogs will be modal on the server side too. Web GUI 
programming will really look like standard GUI programming.

4) Having an event loop, you will be able to watch file, open sockets, 
use timers... in the server process. For example, a WebTimer will run on 
the client side, but a normal Timer will run on the server.

It's really like a telnet or a ssh connection between a terminal and a 
server.

I see the following disadvantages:

1) If your application is big and if you have a lot of users, you will 
need memory and swap. But I don't think it's a big deal against the 
easyness you will get.

2) The data is copied between the CGI script and the session process. So 
it *may* make things a bit slower if you want to handle a big download 
or upload.

3) Beware that only the client can initiate a communication with the 
server. It will behave the same way as the current 'gb.web.form'.

Tell me what you think about that.

Regards,

-- 
Benoît Minisini
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-new-webform-0.0.56.tar.gz
Type: application/gzip
Size: 13168 bytes
Desc: not available
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20191230/d605ff1e/attachment-0001.gz>


More information about the User mailing list