Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collections are not cleaned on close #75

Open
thomasvanlankveld opened this issue Feb 19, 2016 · 1 comment
Open

Collections are not cleaned on close #75

thomasvanlankveld opened this issue Feb 19, 2016 · 1 comment

Comments

@thomasvanlankveld
Copy link

I'm using this DDP client to run Cucumber tests. In between my tests I close the connection and reopen it, in between which ddp.collections is not cleaned. This results in the same documents getting pushed into it multiple times.

I currently solve this by doing:

ddp.close();
ddp.collections = {};
@vsivsi
Copy link
Member

vsivsi commented Apr 1, 2016

Hi, I was looking at this for v0.12.0, but it seems that the DDP spec is silent on this issue. The Meteor.disconnect() call is the nearest analog to ddp.close() in the Meteor API, and it pretty explicitly says that while collections (obviously) stop updating, they are not cleared by even an intentional disconnect. Although this package also does not have an exact equivalent to the Meteor.reconnect() functionality, running ddp.connect() seems to have much the same effect. However, the issue seems to be that the session identifier doesn't appear to ever be (re)used, which prevents the server from knowing the existing state of the collections, to prevent re-sending data.

So I see two possible solutions. Either remain "sessionless" and always clear the collections upon connect, which will mean all subscriptions will need to be renewed, etc., or alternatively, add the ability to reconnect, reusing the session id, and maintaining existing subscriptions, etc.

This seems a little too complex to implement for the 0.12.0 release that is almost ready, but since I considered this issue for it, I thought I'd just document my thoughts on it here...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants