Skip to content

Commit

Permalink
Merge pull request Flotype#154 from dcolens/master
Browse files Browse the repository at this point in the history
Add support for configuring the client-side socket.io's path (better reverse-proxy support)
  • Loading branch information
ericz committed Jan 2, 2012
2 parents 2c5945f + 9e15ee5 commit db4cfb0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions doc/public/user_manual.md
Expand Up @@ -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.

Expand Down
4 changes: 3 additions & 1 deletion lib/client/now.js
Expand Up @@ -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 = {};
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit db4cfb0

Please sign in to comment.