Tuesday 17 November 2015

How to create a PUB/SUB system like Meteor with Express or another framework ?

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 information back 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');

Submitted November 16, 2015 at 06:34PM by skini26

No comments:

Post a Comment