Created
June 2, 2016 21:41
-
-
Save davidguttman/b2c19e096f68f6973692160097bb7230 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var server = http.createServer(handler) | |
var wsock = shoe(function (stream) { | |
var sock = net.connect(config.multilevel) | |
sock.on('error', function(err) { | |
sock.destroy() | |
if (err) return console.error(err) | |
}) | |
sock.on('close', function() { | |
stream.destroy() | |
}) | |
stream.pipe(sock).pipe(stream) | |
}) | |
wsock.install(server, '/multilevel') | |
return server |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment