How do I wait for successful connection using DDP in meteor (server -> server)

The idea of reactivity doesn’t exist in this form on the server, so something like the Tracker is not an option. Fortunately though there is the onReconnect callback you can use. You can steal the required logic from my meteor-serversync package:

const connection = DDP.connect(URL);
connection.onReconnect = function() {
  console.log("(re)connected");
  if (!initialized) {
    options.onConnect && options.onConnect();
  }
};

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top