oortcloud / node-ddp-client

A callback style DDP (Meteor's Distributed Data Protocol) node client.
Other
263 stars 80 forks source link

DDP Client does not work with Meteor 0.9.2.2 #42

Closed ghost closed 10 years ago

ghost commented 10 years ago

Hello,

When I try:

var ddpclient = new DDPClient({ host: urls.build.hostname, port: urls.build.port, autoReconnect: true });

 // When we are connected / reconnected then run the handed function
ddpclient.connect(function(error) {
   console.log('RE-/CONNECTED');
 });

It works only during the first connection. No more, when reconnecting. (autoReconnect is set to true).

emgee3 commented 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?

ghost commented 10 years ago

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 :)

emgee3 commented 10 years ago

Oh, makes sense. You're welcome.