Hi Henrik, first of all, thank you for the article and the good work!
However, I must say that I have doubts about the benefits of WebSockets in general. I cannot see that they are worth the overhead. They introduce a complicated machinery, which is not just a simple protocol extension, but a fundamental change in the HTTP transaction principles. As that, it violates the PicoLisp philosophy of "minimizing the number of concepts". Second, they require a browser which can handle them. This excludes, for example, text browsers like 'w3m'. Third, I'm still waiting for the killer-application which really needs them. All scenarios I have seen so far can be handled with the standard PicoLisp framework much more easily - without explicit maintenance tasks lile "clearing out disconnected clients" and "sending a ping ... to keep the connection alive". All this is already done automatically. To keep with the typical "realtime chat", a minimal setup could be: ######################################################################## #!/usr/bin/pil (load "@lib/http.l" "@lib/xhtml.l" "@lib/form.l") (de chat () (app) (action (html 0 "Chat" "@lib.css" NIL (form NIL (gui 'log '(+FileField) "chat.log" 60 20) (--) (gui 'msg '(+TextField) 60) (gui '(+Click +Auto +Button) 2000 'This 2000 "Chat" '(when (val> (: home msg)) (out "+chat.log" (prinl @)) (clr> (: home msg)) ) ) ) ) ) ) (server 8080 "!chat") (wait) ######################################################################## Put this into a file called "chat", set it to executable, and start it as: $ ./chat Then point some browser windows to "http://localhost:8080". Everything typed into the 'msg' text field (and even in the 'log' field above it) appears in all other connected clients after maximally 2 seconds. Note that also text browsers like w3m can be used. Just the automatic firing of the button won't happen without JavaScript, so the user must press the "Chat" button whenever he wants an update. Also note that due to the same-origin-policy of JavaScrpt (repeatedly discussed here) the "Chat" buttun must be pressed in the beginning once, unless - as usually recommended - 'httpGate' is running and the client connected directly to "http://localhost". Other features like a notification system can be implemented even simpler. You could, for example, clone the existing 'ping' and '<ping>' functions in "@lib/xhtml.l" and extend them to carry a payload. ♪♫ Alex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe