Skip to content

Commit 12064d8

Browse files
committed
[doc test] Small updates to README.md. Update to try require socket.io
1 parent bd6a262 commit 12064d8

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ You have all the full flexibility of node-http-proxy offers in HTTPS as well as
226226
<pre>
227227
var fs = require('fs'),
228228
https = require('https'),
229-
httpProxy = require('httpProxy');
229+
httpProxy = require('http-proxy');
230230

231231
var options = {
232232
https: {
@@ -265,7 +265,7 @@ You have all the full flexibility of node-http-proxy offers in HTTPS as well as
265265
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:
266266
<pre>
267267
var http = require('http'),
268-
httpProxy = require('httpProxy');
268+
httpProxy = require('http-proxy');
269269

270270
//
271271
// Create an instance of node-http-proxy

examples/web-socket-proxy.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,20 @@
2626

2727
var sys = require('sys'),
2828
http = require('http'),
29+
colors = require('colors'),
2930
websocket = require('./../vendor/websocket'),
30-
utils = require('socket.io/lib/socket.io/utils'),
31-
io = require('socket.io'),
3231
httpProxy = require('./../lib/node-http-proxy');
3332

33+
try {
34+
var utils = require('socket.io/lib/socket.io/utils'),
35+
io = require('socket.io');
36+
}
37+
catch (ex) {
38+
console.error('Socket.io is required for this example:');
39+
console.error('npm ' + 'install'.green + ' socket.io'.magenta);
40+
process.exit(1);
41+
}
42+
3443
//
3544
// Create the target HTTP server
3645
//

test/web-socket-proxy-test.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,22 @@
2626

2727
var vows = require('vows'),
2828
util = require('util'),
29+
colors = require('colors'),
2930
request = require('request'),
3031
assert = require('assert'),
31-
io = require('socket.io'),
32-
utils = require('socket.io/lib/socket.io/utils'),
3332
websocket = require('./../vendor/websocket'),
3433
helpers = require('./helpers');
3534

35+
try {
36+
var utils = require('socket.io/lib/socket.io/utils'),
37+
io = require('socket.io');
38+
}
39+
catch (ex) {
40+
console.error('Socket.io is required for this test:');
41+
console.error('npm ' + 'install'.green + ' socket.io'.magenta);
42+
process.exit(1);
43+
}
44+
3645
var runner = new helpers.TestRunner();
3746

3847
vows.describe('node-http-proxy/websocket').addBatch({

0 commit comments

Comments
 (0)