Skip to content
This repository has been archived by the owner on Aug 10, 2024. It is now read-only.

Housekeeping on client connections #2

Closed
sanity opened this issue Jan 9, 2017 · 4 comments
Closed

Housekeeping on client connections #2

sanity opened this issue Jan 9, 2017 · 4 comments

Comments

@sanity
Copy link
Member

sanity commented Jan 9, 2017

Information on WebSocket connection to clients is kept in KWeb.clients, currently a ConcurrentHashMap.

This means that they won't be deleted until the server is restarted. We should keep track of when clients disconnect from the server and delete any associated data.

@sanity
Copy link
Member Author

sanity commented Jan 10, 2017

Per @swishy, Wasabi doesn't yet have a callback for a websocket connection closing, but he is going to add it.

@swishy
Copy link
Contributor

swishy commented Jan 10, 2017

See wasabifx/wasabi#108, thanks Ian.

@sanity
Copy link
Member Author

sanity commented Mar 10, 2017

Note that we also need a mechanism to allow resources to be cleaned up when a client connection is terminated. This could be a callback specified within the buildPage function passed to the KWeb constructor. Here is what it might look like:

KWeb() {
   // ... build page here
  onDisconnect() {
    // Cleanup resources here
  }
}

Here we've added a onDisconnect method to the RootReceiver which registers a listener that is called when this client disconnects. Because it is within the buildPage function it can have access to all variables defined when the page is set up.

@sanity
Copy link
Member Author

sanity commented Dec 15, 2018

This was fixed in commit bb43a39 (sorry about the crappy commit message).

@sanity sanity closed this as completed Dec 15, 2018
sanity added a commit that referenced this issue Oct 18, 2022
tokuhirom pushed a commit to tokuhirom/kweb-core that referenced this issue Oct 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants