Any way for the server end to send a signal to the client code?


I have a package that’s 100% client-only, and I need that to be invoked when something on the server side happens. In other words:

Meteor.onConnection(function (conn) {
  // do something on client-side

How would I go about doing this?


create simple collection and communicate by sending documents there
and cursor.observe or cursor.observeChanges


So I’ll just wind up having a collection in my database called “connections” or something like that? I thought of that, but wanted to keep this a database-free solution.


Can you give an example of what might happen on the server? It’s easier to come up with a solution with a concrete question.


Check this out for inspiration:


Nothing, basically. I just want the server side to watch for a connection from a user via Meteor.onConnection, and then have the client do something like pop up a box, or populate a Session variable.


You could do something like this.{
    var self = this;
         // do stuff

Since Meteor.status() is a reactive data-source it will trigger an autorun whenever it changes.

The documentation on Meteor.status() can be found here.