Aug 23, 2017 · 1 min read
There is! I actually haven’t accounted for that millisecond delay with this code, but all these subscribes/unsubscribes are messages sent via WebSocket, so there can be a short delay in having those messages sent and processed.
So maybe a more conservative approach would wait for the new subscription before unsubscribing from the old and make sure you don’t post duplicate messages from both subscriptions in the meantime. A bit excessive for this tutorial, but a reasonable setup.
