Skip to content

Instantly share code, notes, and snippets.

@tanepiper
Created June 21, 2012 16:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tanepiper/52f10c705c6477e86f69 to your computer and use it in GitHub Desktop.
Save tanepiper/52f10c705c6477e86f69 to your computer and use it in GitHub Desktop.
var http = require('http');
var sockjs = require('sockjs');
var ecstatic = require('ecstatic')(__dirname + '/static');
var dnode = require('../../');
var server = http.createServer(ecstatic);
server.listen(9999);
var sock = sockjs.createServer();
sock.on('connection', function (stream) {
var d = dnode({
transform : function (s, cb) {
var res = s.replace(/[aeiou]{2,}/, 'oo').toUpperCase();
cb(res);
}
});
d.on('remote', function(remote) {
console.log('remote', remote);
});
d.pipe(stream).pipe(d);
});
sock.installHandlers(server, { prefix : '/dnode' });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment