RocketChat / meteor-streamer

2 way communication over DDP with better performance.
MIT License
82 stars 27 forks source link

Multiple servers? #8

Open artpolikarpov opened 8 years ago

artpolikarpov commented 8 years ago

Does this works with multiple servers?

ejfrancis commented 8 years ago

Hey @artpolikarpov,

In PR #5 I added the option to provide your own DDP connection to another server so it should work as long as you create your own DDP connection and provide it like so

  const ddpConnection =  DDP.connect(url);
  const client = new Meteor.Streamer(tname, {
      ddpConnection
    });

But I've just run into an issue today where a warning is logged if you have multiple streamers with the same name because of this on the client and this on the server. That check made sense when you could only use one DDP connection across all instances, but now that it supports multiple instances it's a very valid use case to have multiple connections with the same name to different servers.

@rodrigok is it alright if I remove that warning if you're providing an instance with a different ddp connection? since in that case it really is a new, unique streamer

neurobe commented 8 years ago

@ejfrancis @rodrigok yes, can simplify code when switching modes of operation, like in my case switching from networked to standalone operation. look forward to update pls.

neurobe commented 8 years ago

@ejfrancis @rodrigok opened my feature request related to this issue #9

hridayeshgupta commented 6 years ago

any update/example on this?

lorensr commented 6 years ago

If the question does this package work if your Meteor server is scaled to multiple containers, I think the answer is no. Events aren't stored in a database—events received by container A are sent out to all subscriptions that came to container A, but not to subscriptions that came to container B.

maxnowack commented 6 years ago

@lorensr it's possible. See #26 😊