Effect CommunityEC
Effect Community15mo ago
6 replies
Perry

Help with stream merge and updates

Hello!

There is a main stream (you can see this as wsRepo.streamPolymarketBook(assetIds)), which accepts an array of string - assetIds. We wanted to have this streamPolymarketBook to be re-started, when assetIds is changed. assetIds is read from the DB through polyRepo.getPolyAssetIds()

So, we created a SubscriptionRef, stored the assetIds into the ref, and when the values are changing, we updated the subscriptionRef.. then we got the stream from SubscriptionRef.changes, merged it with the main stream, hoping when the assetIds is changed, and the main stream is called again.

Now the problem is when the subscriptionRef is updated with the new assetIds, the main stream is not called again according the log. (log inside streamPolymarketBook is not happening). I really appreciate if you suggest the fixes. I will attach the code in the following message. Thanks in advance!
Was this page helpful?