Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
How to aggregate streams? (multiplexer/demultiplexer)
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
lbdremy  
View profile  
 More options Sep 3 2012, 5:44 am
From: lbdremy <remyloubra...@gmail.com>
Date: Mon, 3 Sep 2012 02:44:24 -0700 (PDT)
Local: Mon, Sep 3 2012 5:44 am
Subject: How to aggregate streams? (multiplexer/demultiplexer)

Hello,

I'm wondering, does someone know a module that is able to aggregate
multiple streams into 1.
For example you give it 3 readable streams and you get 1 stream emitting
all `data ` events from these 3 streams and emitting the `end` event when
the 3 streams are ended.
Same thing for writable streams, where when you write, you actually write
to 3 streams.
And a combinaison of both for writable/readable streams.

Thanks,


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Oleg Efimov (Sannis)  
View profile   Translate to Translated (View Original)
 More options Sep 3 2012, 6:23 am
From: "Oleg Efimov (Sannis)" <efimo...@gmail.com>
Date: Mon, 3 Sep 2012 03:23:11 -0700 (PDT)
Local: Mon, Sep 3 2012 6:23 am
Subject: Re: How to aggregate streams? (multiplexer/demultiplexer)

Aggregate is available in https://github.com/Obvious/pipette.

понедельник, 3 сентября 2012 г., 13:44:24 UTC+4 пользователь lbdremy
написал:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jake Verbaten  
View profile  
 More options Sep 3 2012, 1:19 pm
From: Jake Verbaten <rayn...@gmail.com>
Date: Mon, 3 Sep 2012 10:19:18 -0700
Local: Mon, Sep 3 2012 1:19 pm
Subject: Re: [nodejs] How to aggregate streams? (multiplexer/demultiplexer)

https://github.com/dominictarr/mux-demux

MuxDemux is fantastic.

However what your asking for is not a multiplexer.

3 readable streams into one stream:

  var newStream = through()
  stream1.pipe(newStream)
  stream2.pipe(newStream)
  stream3.pipe(newStream)

write to one into 3

  var writeStream = through()
  writeStream.pipe(stream1)
  writeStream.pipe(stream2)
  writeStream.pipe(stream3)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
lbdremy  
View profile  
 More options Sep 9 2012, 11:36 am
From: lbdremy <remyloubra...@gmail.com>
Date: Sun, 9 Sep 2012 08:36:53 -0700 (PDT)
Local: Sun, Sep 9 2012 11:36 am
Subject: Re: [nodejs] How to aggregate streams? (multiplexer/demultiplexer)

Thanks for your answers :),

The aggregate module does the job of aggretate 3 readables stream into 1
with the Cat "class", thanks.

The code that you propose Raynos doesn't work for this case, because when
the first readable stream will emit "end", the pipe method will call the
end method of the writable stream.
Which means the writable stream is not more writable since "this.writable"
is set to false when the end method is called. So next time another of the
readable streams will emit "data", two things can happen, the pipe method
call the write method of the writable stream in this case the writable
stream shoud/will throw an error since the end method has been called
before and "this.writable" is false or the data emitted will be ignored
because the writable stream has its "this.writable" set to false. Am I
right or I miss something important in the code?

For the second piece of code, you are completely right, I haven't think
about it but it seems there is no need to do some sort of control on the
different events since the trouble happens when data are emitted when the
method end has already been called, in this case it can't happen. But maybe
it would be nice to have a stream who know exactly how many streams will be
piped and so return false when write is called until all streams are piped
or cache the data emitted until all streams are piped.

Interesting, why this could not be considered as demultiplexer
and multiplexer?
Tell me more, thank you.

Le lundi 3 septembre 2012 18:19:34 UTC+1, Raynos a écrit :


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dominic Tarr  
View profile  
 More options Sep 12 2012, 5:35 pm
From: Dominic Tarr <dominic.t...@gmail.com>
Date: Wed, 12 Sep 2012 23:35:02 +0200
Local: Wed, Sep 12 2012 5:35 pm
Subject: Re: [nodejs] How to aggregate streams? (multiplexer/demultiplexer)
in electronics, multiplexer allows multiple channels to communicate
over a single channel.

http://en.wikipedia.org/wiki/Multiplexer

"An electronic multiplexer makes it possible for several signals to
share one device or resource, for example one A/D converter or one
communication line, instead of having one device per input signal.

On the other hand, a demultiplexer (or demux) is a device taking a
single input signal and selecting one of many data-output-lines, which
is connected to the single input. A multiplexer is often used with a
complementary demultiplexer on the receiving end"

You just want to merge the streams. I have some code here
https://github.com/dominictarr/event-stream/blob/master/index.js#L25-57

although it seems to have escaped the readme. oops. also, the comment is wrong.
it doesn't concat.

use this if you want to concatenate:
https://npmjs.org/package/kat


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tim Dickinson  
View profile  
 More options Sep 15 2012, 9:46 pm
From: Tim Dickinson <price.ti...@gmail.com>
Date: Sat, 15 Sep 2012 18:46:00 -0700 (PDT)
Subject: Re: How to aggregate streams? (multiplexer/demultiplexer)

LOL I should have searched the group. I asked this question like two days
latter.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »