How to send a message from Server to Client in Meteor?
<p>I want to send a message from a Server script in 'server/main.js' to a Cliente script in 'client/main.js'.</p>

<p>I tried a few things with Publish/Subscribe, but i must have done something wrong. The console where the meteor server is running gone crazy with thousands of error messages.</p>

<p>server</p>

<pre><code>Meteor.publish("test", function () {
    this.ready();
    return 'some test';
  });
</code></pre>

<p>client</p>

<pre><code>Template.panel.onCreated(function loginOnCreated() {
  Tracker.autorun(function () {
    const handle = Meteor.subscribe('test');
    if(handle.ready()){
      alert('Done')
    }
  });
});
</code></pre>

<p>Anyway, I need a server method to call something in client when it's ready.</p>

<p>Reason: Template.panel.onCreated can't query data from Mongodb. It has to wait some seconds. So what I want to do is not possible in Template.panel.onCreated in client. It has to wait until Mongo is ready.</p>

<p>How can I do this?</p>