v0.0.3 Upgrade to uWS v20.35.0
What is changed in socketify:
- uWebSockets v20.35.0
- uWebSockets header removed and Server header added
- ws.publish now have the same behavior as app.publish
- subscription event added see v20.32.0 description and https://github.com/cirospaciari/socketify.py/blob/main/examples/broadcast.py
What's new in uWS since the last update?
v20.35.0
Bug fixes
v20.34.0
Easy shutdown with app.close()
Calling this new function will:
Close and invalidate all open listen sockets.
Force close all open connections (both HTTP and WebSockets), calling their respective callbacks as needed (.on_aborted, .close, .subscription).
This call can be used to gracefully close and release an App that needs maintenance.
v20.33.0
Rebalancing with max lifetime
A reworked timeout system now allows two lightweight timeout settings for WebSockets; idle timeout (up to 16 minutes) and max lifetime (up to 4 hours):
idle timeout is how long (in seconds) a WebSocket may be idle (have no traffic) before it is considered closed.
max lifetime is how long (in minutes) a WebSocket may be connected, before being gracefully closed by the server.
Specifying a value of 0 disables the respective features (the default for max lifetime).
Why use max lifetime?
The idea here is to enforce a partial rebalancing, constantly forcing a few connections to reconnect via whatever load balancer is in use. This is a strategy used by Netflix where they found success in having max lifetime = 30 minutes.
Good values for the settings should be somewhere around 30-120 seconds idle timeout and 30-120 minutes max lifetime.
v20.32.0
Subscription events
A new kind of event has been added. Whenever a ws.subscribe or ws.unsubscribe call is made, or when implicit unsubscription happens (such as when a WebSocket has subscriptions and gets closed in any way), a subscription event will fire with:
- the WebSocket involved
- the topic name
- the new number of subscribers to this topic
- the former number of subscribers to this topic
These events can be used to easily manage external subscriptions such as when using Redis to orchestrate multiple instances of uWS. Whenever a subscription event with new subscription count == 1; you can create the corresponding Redis subscription. Whenever a subscription event with new subscription count == 0; you can free the corresponding Redis subscription.
Work in progress for v0.1.0:
- Better routers #59
- Hot reloading #61
- Plugins / Extensions #62
- on_start, on_shutdown hooks #58
- Cache tools #60
- Native optimizations #52
Take a look at https://github.com/cirospaciari/socketify.py/issues?q=is%3Aissue+is%3Aopen+label%3Aenhancement to see all planned features