I have multiple meteor apps between which I need to keep data synchronized. DDP.connect
is great for that, but unfortunately right now every time the apps get disconnected from one another, DDP creates a new connection/session on the publisher side. This means that it will send the entire collection to the subscriber again once reconnected. In my situation that is, unfortunately, prohibitive – I need to be economical about data transfers and dis-/reconnections are frequent.
The docs state that:
Currently when a client reconnects to the server (such as after temporarily losing its Internet connection), it will get a new connection each time. The onConnection callbacks will be called again, and the new connection will have a new connection id.
In the future, when client reconnection is fully implemented, reconnecting from the client will reconnect to the same connection on the server: the onConnection callback won’t be called for that connection again, and the connection will still have the same connection id.
Any hints on how I might be able to get this working already now, i.e., before it is supported by meteor itself? I’ve tried setting this.connection.id
manually in the onReconnect
handler, but that didn’t do the trick – unsurprisingly.