I have an observable like this:
const records$ =
Rx.DOM.fromWebSocket('ws://192.168.2.4:9001/feed/', null)
.map(ev => parseRecord(ev.data))
.share();
I have many subscribers. When the connection is lost, all subscribers unsubscribe:
let records$Subscription;
records$Subscription = records$.subscribe(
record => { ... },
error => records$Subscription.dispose()
);
I verified that the call to dispose
is indeed being made once for every subscription. Therefore, the share
refcount has reached zero.
However, when I now subscribe to records$
again, no new WebSocket connection is set up. When I remove the call to share
, however, it is. How come this doesn't work as expected with share
?