This question is old, but for future references.
Socket.IO is famous, and for node stream https://github.com/substack/stream-handbook should be interesting to you.
I personally do this on my own project:
http://kenokabe.github.io/MarkdownLive/
I write stuff using Markdown and needed a streaming preview, so I created by myself. The preview screen is a Browser HTML page, and the HTML contents rendered and updated incrementally in streaming manner.
This technology is generally called RPC(remote procedure call)
. Socket.IO is familiar to many people and you can find abundant resource on the web, so good thing to start.
However, I personally do not use it anymore since it's a huge library just to do RPC between node and browser, especially when you do know you don't need any fallbacks to other than websocket.
The more concise and sophisticated (I think) and seamless way to do RPC here is to use
dnode or rpc-stream
with Browserify.
Proof: the below is the code on the client side (browser) of my own project:http://kenokabe.github.io/MarkdownLive/
https://github.com/kenokabe/MarkdownLive/blob/master/www/js/index.js
(function() //-----
{
"use strict";
$(document)
.ready(function()
{ //--------------------------
$('#streamDIV')
.html('<h1>MarkdownLive</h1><h3>Markdown Streaming Live View for SublimeText3</h3><br><h4><strong>Open</strong> <br><br>.md<br>.markdown<br>.mdown<br>.mkdn<br>.mkd<br>.mdwn<br>.mdtxt<br>.mdtext<br>.text<br>.txt</h4>');
var through = require('through');
var stream = require('shoe')('/stream')
.pipe(through(function(data)
{
$('#streamDIV')
.html(data);
}));
//-------------------------
});
}());
Using node.js stream properly, it's possible to write a server-client RPC code in concise Declarative programming or FRP manner.
There is no native implementation of webSocket in node.js
Web Sockets server side implementation for NodeJS
and
Socket.IO is based on ws.
WebSocket layer
ws
or sock-js or the others.
Stream layer
https://github.com/maxogden/websocket-stream for ws
https://github.com/NodeGuy/WebSocketStream for ws
https://github.com/kenokabe/WebSocketStreamPlus (my work based on NodeGuy's one)
https://github.com/substack/shoe for sock-js
RPC layer
https://github.com/substack/dnode
https://github.com/dominictarr/rpc-stream