What are the best options to integrate message streams in Meteor 1.3


I’m trying to add streaming messages to a Meteor 1.3 app.

I’ve looked at:

Meteor-streams is obviously dead. Should I add Socket.IO as an npm module and use that or is there another solution I should look into?


I had to do this recently. Used an event emitter on the server to stream messages with a null publication.

// some client file.
import {Mongo} from "meteor/mongo";

export const Messages = new Mongo.Collection('_messages');

export default Messages;

then on your server do some null publication. You can combine this with some kind of event emitter instance.

import {Meteor} from "meteor/meteor";
import {Random} from "meteor/random";
import {EventEmitter} from 'events';

const myEmitter = new EventEmitter();

Meteor.publish(null, function () {
  // do something for when a message is added.
  const onMessage = Meteor.bindEnvironment(data => {
    this.added('_messages', Random.id(), { message: data.toString('ascii') });
  myEmitter.on('message', onMessage);

  this.onStop(() => myEmitter.removeListener('message', onMessage));