I have the following use case:

I want to display a list of entries that both gets new entries pushed to - 
inserted at top - and historical ones appended at the bottom, if you click 
'show more'.

now what's the cleanest way of doing this? (although this is in a browser 
environment, I use streams (github.com/juliangruber/stream) and eventemitters 
(github.com/component/emitter), so this is a node topic.

Possibilities I've come up with:

Use one stream that emits entries with dates and the list inserts them at the 
right position. The stream has to now how many entries it has to fetch from the 
api, initially and on 'show more'. Not very streamy...

Use two streams. streams.new streams to the list's top, streams.historical to 
the bottom (including the initially fetched entries). This way the list can be 
dumber as it doesn't have to reorder.

Use one stream for new entries and one emitter for historical ones, as they by 
concept are not streamed.

Use a stream for new entries and fetch historical ones with standard api calls 
and callback style.

Use one emitter that emits entry/new and entry/historical.

Or is there another way of dealing with 'two-way-streams'. This should be a 
common pattern in realtime applications!

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to