Publish Subscribe API similar to Meteor in another Node framework?


#1

Hi,

I know there’s socket.io, but I can’t find examples where it is as ‘‘simple’’ as in Meteor. What I mean by that is :
The client subscribes to a ‘‘channel’’ with custom arguments, and the server sends custom responses to him. With socket.io, the data is generic and not customised per client. I saw some way to create custom publications but I find that it was really not a good idea (sending the parameters in the string of the channel).

Basic example :

  • Client subscribes to : My friend’s posts (like facebook timeline) or my notifications.
  • Server subscribes to RethinkDB or anything that can give him this information in real time.
  • Server pushes the informations to the client when it receives the data from its subscription.

In Meteor, this would be like :

Meteor.publish('myNotifications', function () {
    return Notifications.find({userId: this.userId});
});

Meteor.subscribe('myNotifications');