v20.32.0
版本发布时间: 2022-12-24 19:35:19
uNetworking/uWebSockets最新发布版本:v20.64.0(2024-07-04 03:06:24)
Subscription events
A new kind of event has been added. Whenever a WebSocket::subscribe
or WebSocket::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.