Skip to content

v20.32.0

Compare
Choose a tag to compare
@uNetworkingAB uNetworkingAB released this 24 Dec 11:35
· 145 commits to master since this release

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.