watch() usage from the browser

26 views
Skip to first unread message

Leo

unread,
Sep 30, 2019, 7:30:31 AM9/30/19
to MongoDB Stitch Users
Hello,

I am working on a small application that has to watch a collection for changes and display some data from that collection based on a "status". I attempt to use QueryAnywhere for this and the "watch" command on the collection. Where jobsCollection is a valid RemoteMongoCollection.

stream = await jobsCollection.watch([]);
stream.onNext((event=> {
...
});


This works fine in itself, but after some time there will be an error on loading the page that says there are to many streams open. According to the documentation on Streams, indetical streams should be re-used. Since the only stream I open in the application is this stream to this particular collection (even if I do it from multiple devices) I do not expect this to open multiple streams on the Atlas backend.

- What's happening here?
- What could I do to prevent this from happening?
- Is there a place where I can see the current number of open streams on the server?

Hope anyone can help, much appreciated!

Kind regards,
Leo
Reply all
Reply to author
Forward
0 new messages