Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add support for configuring the client-side socket.io's path (better reverse-proxy support) #154

Merged
merged 2 commits into from

2 participants

@dcolens

Using the client.socketio.resource option to set the path for socket.io.js instead of using the hardcoded default value of /socket.io/socket.io.js.
client.socketio.resource defaults to socket.io.

@ericz ericz merged commit db4cfb0 into from
@ericz

Thanks for the contribution @dcolens. Sorry for taking so longer to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 1 deletion.
  1. +4 −0 doc/public/user_manual.md
  2. +3 −1 lib/client/now.js
View
4 doc/public/user_manual.md
@@ -217,6 +217,10 @@ available options and their defaults:
// Do note that the object that this points to should already exist by the time now.js is loaded.
}
+If the `client.socketio.resource` option is set it will also be used
+for the path of the socket.io.js file. This option can be useful in
+the case of a reverse proxy setup.
+
If the options object is incomplete, the default values will be used
in place of any missing options.
View
4 lib/client/now.js
@@ -6,6 +6,8 @@
return nowObjects[uri];
}
options = options || {};
+ options.socketio = options.socketio || {};
+ options.socketio.resource = options.socketio.resource || "socket.io";
var socket;
var closures = {};
@@ -535,7 +537,7 @@
};
var dependencies = [
- { key: 'io', path: '/socket.io/socket.io.js'}
+ { key: 'io', path: '/' + now.core.options.socketio.resource + '/socket.io.js'}
];
var dependenciesLoaded = 0;
Something went wrong with that request. Please try again.