[fpc-pascal] FCL-Web updates/extensions
Michael Van Canneyt
michael at freepascal.org
Wed Sep 1 13:06:16 CEST 2021
Hello,
Thanks to the efforts of Ondrej Pokorny and some sponsored work by the
FPC/Lazarus foundation, FCL-Web has received some updates:
- Improvements in fcl-net, basically a Select() call has been added to the
socket stream, on all platforms that support this.
- Possibility to keep connections open in the HTTP Server (keep-alive).
- A HTTP client connection pool, for parallel downloading.
- HTTP Client Downloads can now be canceled.
- New threading model for the FPC HTTP server:
- No threading
- One thread per request/connection
- Thread pool, distributing requests over available threads.
- The thread pool functionality is in a separate unit, available for other things as
well...
- Interceptors in the HTTP router:
In the HTTP router you can now register interceptors.
These will be run before/after the request is dispatched to the correct handler.
Interceptors can cancel further handling of a request:
This allows you to implement e.g. authentication, logging etc. in an
orthogonal manner to normal request handling.
- The FPC HTTP server can now handle Connection: upgrade using registered
upgrade handlers. This can be used for websocket (see below) and later
HTTP/2 handling.
- FPC has now native support for the websocket protocol: both client and
server are supported. Native chat client/server demos are included,
and a pas2js client for use in the browser is also available.
(SSL support is there but still needs testing)
- The websocket protocol support can be attached to the HTTP server. That
means you can initiate a websocket connection on the same port as the HTTP
server is listening; the HTTP server will hand off the connection to the
websocket server using the upgrade mechanism. A server demo is included as well.
Attached a small screenshot of the websocket-based chat program in pas2js.
Enjoy,
Michael.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: chatbox.png
Type: image/png
Size: 39878 bytes
Desc:
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20210901/710131f9/attachment-0001.png>
More information about the fpc-pascal
mailing list