Closed ghost closed 10 years ago
The following works for me:
var ddpclient = require('ddp');
var ddpclient = new DDPClient({
host: "127.0.0.1",
port: 3000,
autoReconnect: true
});
// When we are connected / reconnected then run the handed function
ddpclient.connect(function(error) {
console.log('RE-/CONNECTED');
});
The Meteor application is running:
Meteor 0.9.2.2
When triggering a server restart the client reconnects:
$ node testing.js
RE-/CONNECTED
RE-/CONNECTED
The only other thought I have is check the version of the ddp client — are you running the most recent, 0.8.1? The instantiation options changed in 0.8.0.
If that doesn't do it, I'm happy to help debug but I don't have enough to work on. Can you create a cloneable reproduction?
Yeap, you are right. I didn't understand how it works.
In previous versions of Meteor, ddpclient.connect was invoked also for changes made in client side as these changes restarted a whole server. Now, it is divided into changes in a client side and a server side, so unfortunately, we cannot monitor changes in a client side by this functionality.
Thanks :)
Oh, makes sense. You're welcome.
Hello,
When I try:
It works only during the first connection. No more, when reconnecting. (autoReconnect is set to true).