Skip to content

Instantly share code, notes, and snippets.

@jcrugzz
Created September 14, 2013 18:48
Show Gist options
  • Save jcrugzz/6564506 to your computer and use it in GitHub Desktop.
Save jcrugzz/6564506 to your computer and use it in GitHub Desktop.
var caronte = require('caronte');
var ws = require('ws');
var proxy = caronte.createProxyServer({
ws: true,
target: 'http://localhost:9000'
});
var wss = new ws.Server({ port: 9000 })
wss.on('connection', function (ws) {
ws.on('message', function (message) {
console.log('Server Recieved message ' + message);
});
ws.send('something');
});
var proxyServ = proxy.listen(3000);
var WebSocket = new ws('ws://localhost:3000');
WebSocket.on('open', function () {
WebSocket.send('client sent message');
});
WebSocket.on('message', function (message) {
console.log('client recieved message' + message);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment