rabbibotton / clog

CLOG - The Common Lisp Omnificent GUI
Other
1.53k stars 106 forks source link

Handling living ws connections after CLOG:SHUTDOWN as well as related modifications #200

Closed shakatoday closed 2 years ago

shakatoday commented 2 years ago

Brief

  1. Code maintainability of boot-js.
  2. Let WebSocket servers close those connections whose clients don't provide a proper connection-id.

Code maintainability of boot-js.

Done in SSOT for compiled boot-js and base version of js/boot.js

  1. SSOT for compiled-boot-js and static-files/js/boot.js. They are currently 100% the same. (except for the first line comment /*static version*/ VS. /*compiled version*/, of course).
  2. Better to separate js code to js files if possible. Editors can recognize them for many benefits.

    Done in have asdf watch file changed of boot.js in clog system source

    Having asdf watch file change of boot.js in clog system source, so asdf and quickload will reload the system if needed.

    Let WebSocket servers close those connections whose clients don't provide a proper connection-id.

  3. Let a WebSocket server closes the connection if there's no corresponding connection-id.
  4. Let a WebSocket server closes the connection if the client wants to reconnect with an invalid connection-id.
  5. Let the client (default boot.js) stop reconnecting if the server closes the connection with a normal clause.

    More about letting a WebSocket server closes the connection if there's no corresponding connection-id.

    After (clog:shutdown), established WebSocket connections are somehow still alive. They occupy computation & memory resources.

    
    Connection b65ae6f45e44ee4992a5bec4eeed04e8    Ping

CL-USER> (clog:shutdown) NIL Connection NIL Ping
Connection NIL Ping Connection NIL Ping ; the connection is somehow still alive

The result of [Close zombie websocket connection](https://github.com/rabbibotton/clog/commit/e0aeae7690265caff18a29987bfb7bf76876b50c)
```lisp
CL-USER> clog-connection:*verbose-output*
T
Connection cb39d163104ce9fbc6b6b43684be8bdc    Ping
Connection cb39d163104ce9fbc6b6b43684be8bdc    Ping
CL-USER> (clog:shutdown)
NIL
A zombie connection #<SERVER {7017AA7DF3}>. CLOG doesn't remember its connection-id. Closing it.

This should be seen as a temporary solution because ideally (clog:shutdown) should have completed the job.

rabbibotton commented 2 years ago

Looks amazing! Great work on improving CLOG!