I have a model that will subscribe a websocket to several expensive end points when the user is on particular routes. When the user leaves the route, I want to disconnect the websockets.
The dva api docs say
Notice: if we want to unregister a model with
app.unmodel()
, it's subscriptions must return unsubscribe method.
However the docs do not include how to register a subscription with an unsubscribe
method.
How does one create a subscription with an unsubscribe
handler?