mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
[doc test] Small updates to README.md. Update to try require socket.io
This commit is contained in:
parent
bd6a2622ad
commit
12064d8e5d
@ -226,7 +226,7 @@ You have all the full flexibility of node-http-proxy offers in HTTPS as well as
|
|||||||
<pre>
|
<pre>
|
||||||
var fs = require('fs'),
|
var fs = require('fs'),
|
||||||
https = require('https'),
|
https = require('https'),
|
||||||
httpProxy = require('httpProxy');
|
httpProxy = require('http-proxy');
|
||||||
|
|
||||||
var options = {
|
var options = {
|
||||||
https: {
|
https: {
|
||||||
@ -265,7 +265,7 @@ You have all the full flexibility of node-http-proxy offers in HTTPS as well as
|
|||||||
Websockets are handled automatically when using the `httpProxy.createServer()`, but if you want to use it in conjunction with a stand-alone HTTP + WebSocket (such as [socket.io][5]) server here's how:
|
Websockets are handled automatically when using the `httpProxy.createServer()`, but if you want to use it in conjunction with a stand-alone HTTP + WebSocket (such as [socket.io][5]) server here's how:
|
||||||
<pre>
|
<pre>
|
||||||
var http = require('http'),
|
var http = require('http'),
|
||||||
httpProxy = require('httpProxy');
|
httpProxy = require('http-proxy');
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create an instance of node-http-proxy
|
// Create an instance of node-http-proxy
|
||||||
|
|||||||
@ -26,11 +26,20 @@
|
|||||||
|
|
||||||
var sys = require('sys'),
|
var sys = require('sys'),
|
||||||
http = require('http'),
|
http = require('http'),
|
||||||
|
colors = require('colors'),
|
||||||
websocket = require('./../vendor/websocket'),
|
websocket = require('./../vendor/websocket'),
|
||||||
utils = require('socket.io/lib/socket.io/utils'),
|
|
||||||
io = require('socket.io'),
|
|
||||||
httpProxy = require('./../lib/node-http-proxy');
|
httpProxy = require('./../lib/node-http-proxy');
|
||||||
|
|
||||||
|
try {
|
||||||
|
var utils = require('socket.io/lib/socket.io/utils'),
|
||||||
|
io = require('socket.io');
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
console.error('Socket.io is required for this example:');
|
||||||
|
console.error('npm ' + 'install'.green + ' socket.io'.magenta);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create the target HTTP server
|
// Create the target HTTP server
|
||||||
//
|
//
|
||||||
|
|||||||
@ -26,13 +26,22 @@
|
|||||||
|
|
||||||
var vows = require('vows'),
|
var vows = require('vows'),
|
||||||
util = require('util'),
|
util = require('util'),
|
||||||
|
colors = require('colors'),
|
||||||
request = require('request'),
|
request = require('request'),
|
||||||
assert = require('assert'),
|
assert = require('assert'),
|
||||||
io = require('socket.io'),
|
|
||||||
utils = require('socket.io/lib/socket.io/utils'),
|
|
||||||
websocket = require('./../vendor/websocket'),
|
websocket = require('./../vendor/websocket'),
|
||||||
helpers = require('./helpers');
|
helpers = require('./helpers');
|
||||||
|
|
||||||
|
try {
|
||||||
|
var utils = require('socket.io/lib/socket.io/utils'),
|
||||||
|
io = require('socket.io');
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
console.error('Socket.io is required for this test:');
|
||||||
|
console.error('npm ' + 'install'.green + ' socket.io'.magenta);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
var runner = new helpers.TestRunner();
|
var runner = new helpers.TestRunner();
|
||||||
|
|
||||||
vows.describe('node-http-proxy/websocket').addBatch({
|
vows.describe('node-http-proxy/websocket').addBatch({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user