github soketi/soketi 0.23.0

latest releases: 1.6.1, 1.6.0, 1.5.0...
2 years ago
  • Added cluster adapter & rate-limiting for local scaling with PM2/Forks (#171)
  • Added filters in the webhook configuration to filter the webhooks based on channel name (#223, @stayallive)

Cluster Driver for Scaling & Rate Limiting

With the Cluster driver, deploying multiple node workers with PM2 is going to be easier since Redis will no longer be needed.

Alongside this adapter, you should also decide to use the cluster rate limiter driver in case you have rate limiting in place. This is going to scale the rate-limiting across all known processes.

Refactoring adapter code

The Redis adapter code was really messy, so I decided to come with an approach that will make future horizontal-scaling adapters easier. This required a lot of time, a lot of testing, and ideas to better improve the current code. Squashing ~ 800 lines of code, most of them coming from the code for the Redis adapter.

PM2 Support

With this PR, PM2 is easier to use thanks to the cluster mode.

Graceful Shutdown Time

Graceful Shutdown Time is a fancy term for giving the soketi process enough time to shut down all the current connections and redirect users to other processes, before shutting the process itself. This is useful for horizontal scaling, and this time is arbitrarily given. Default is 3000 ms (3s), but you are now free to customize it by giving more time (or less) for your needs with the SHUTDOWN_GRACE_PERIOD, a value in milliseconds.

Adapters and rate limiters now also got a softer close for the active, like closing the Redis sockets at the very end, when the server is closing.

Small Fixes

  • Upon presence leave or channel leave, the internal WebSocket connection's arrays were not updated in the current sockets list.
  • When shutting down, the adapter clear() method that makes sure it disconnects every socket from the instance was not a Promise, making it hard to predict whether all the sockets were closed in a soft manner

Don't miss a new soketi release

NewReleases is sending notifications on new releases.