[Lazarus] New version of WebDesign available

Joost van der Sluis joost at cnoc.nl
Wed Mar 17 11:58:04 CET 2010


On Wed, 2010-03-17 at 10:36 +0100, Michael Schnell wrote:
> On 03/15/2010 08:56 PM, Joost van der Sluis wrote:
> >> Another example (avoiding any hardware binding) would be a simple http
> >> chat cgi.
> >>     
> > Not without polling
> >
> >   
> 
> I'm not sure what you mean by "polling" here.
> 
> Of course a chat CGI (and the other examples I mentioned) do need
> polling for remote updates of the web page by Java script on the Browser
> site to avoid HTTP timeout. To avoid unnecessary communication,
> AJAX/Comet can be used to create "hanging" HTTP requests that only are
> answered by the CGI program when an update is available or before a
> timeout hits.

By polling I meant that you need it to see if there are any changes. Not
only for the timeout. That's because you can not use a "hanging" http
request.

This can be solved, though. (I don't even think it's much work, we only
need an interface to read the output from the client after the initial
request-headers are parsed. Now the rest of the input is simply ignored)

> OTOH with the standard CGI paradigm, with each HTTP communication the
> CGI program starts and finishes. So the CGI program does not have any
> permanent "states". Thus a "chat" would need to store the text to be
> transferred in a file or a database, creating a huge overhead.

That's not true. What you could do is keep your program/module
persistent in memory. In every cgi-call from the client you include a
session-identifier. Then you can decide on the server side to which
persistent module this call has to be referred to.

> With the "persistent" CGI paradigm, the CGI program keeps living and can
> transfer the text it received from one user to the other just by
> managing the requests that come in from the web server  as byte streams.

Yes, but not using a 'byte stream' but separate requests. (byte stream
is offcource also possible, but see above)

> The NoGUIApplication package, I am planning, will allow for doing such
> persistent CGI applications. I feel that you could create a very viable
> enhancement for WebDesign, optionally enabling persistent CGI, using
> NoGUIApplication. So I'd be happy if you can test this, once I'm able to
> provide a working version.

The fcl-web examples that are online now, all uses rest-handling of
data. If I have some more time i'll write an example to show the
behaviour as described above.

Joost.





More information about the Lazarus mailing list