Commit 8fc8d966 authored by Charlie McConnell's avatar Charlie McConnell

[examples] Updated examples to v0.7.x API.

parent 24ef9194
......@@ -67,12 +67,14 @@ socket.on('connection', function (client) {
//
// Setup our server to proxy standard HTTP requests
//
var proxy = new httpProxy.HttpProxy();
var proxyServer = http.createServer(function (req, res) {
proxy.proxyRequest(req, res, {
var proxy = new httpProxy.HttpProxy({
target: {
host: 'localhost',
port: 8080
})
}
});
var proxyServer = http.createServer(function (req, res) {
proxy.proxyRequest(req, res);
});
//
......@@ -83,11 +85,7 @@ proxyServer.on('upgrade', function (req, socket, head) {
var buffer = httpProxy.buffer(socket);
setTimeout(function () {
proxy.proxyWebSocketRequest(req, socket, head, {
port: 8080,
host: 'localhost',
buffer: buffer
});
proxy.proxyWebSocketRequest(req, socket, head, buffer);
}, 1000);
});
......
......@@ -67,12 +67,14 @@ socket.on('connection', function (client) {
//
// Setup our server to proxy standard HTTP requests
//
var proxy = new httpProxy.HttpProxy();
var proxyServer = http.createServer(function (req, res) {
proxy.proxyRequest(req, res, {
var proxy = new httpProxy.HttpProxy({
target: {
host: 'localhost',
port: 8080
})
}
});
var proxyServer = http.createServer(function (req, res) {
proxy.proxyRequest(req, res);
});
//
......@@ -80,10 +82,7 @@ var proxyServer = http.createServer(function (req, res) {
// WebSocket requests as well.
//
proxyServer.on('upgrade', function (req, socket, head) {
proxy.proxyWebSocketRequest(req, socket, head, {
port: 8080,
host: 'localhost'
});
proxy.proxyWebSocketRequest(req, socket, head);
});
proxyServer.listen(8081);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment