Created
July 11, 2011 07:48
-
-
Save 3rd-Eden/1075441 to your computer and use it in GitHub Desktop.
Debug statement
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Manages connections to hosts. | |
| * | |
| * @param {String} uri | |
| * @Param {Boolean} force creation of new socket (defaults to false) | |
| * @api public | |
| */ | |
| io.connect = function (host, details) { | |
| var uri = io.util.parseUri(host) | |
| , uuri | |
| , socket; | |
| if ('undefined' != typeof document) { | |
| uri.protocol = uri.protocol || document.location.protocol.slice(0, -1); | |
| uri.host = uri.host || document.domain; | |
| uri.port = uri.port || document.location.port; | |
| } | |
| {{ | |
| // confirm that the uri is correctly parsed | |
| io.log.debug('uri', uri); | |
| }} | |
| uuri = io.util.uniqueUri(uri); | |
| var options = { | |
| host: uri.host | |
| , secure: uri.protocol == 'https' | |
| , port: uri.port || 80 | |
| }; | |
| io.util.merge(options, details); | |
| if (options['force new connection'] || !io.sockets[uuri]) { | |
| socket = new io.Socket(options); | |
| } | |
| if (!options['force new connection'] && socket) { | |
| io.sockets[uuri] = socket; | |
| } | |
| socket = socket || io.sockets[uuri]; | |
| // if path is different from '' or / | |
| return socket.of(uri.path.length > 1 ? uri.path : ''); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
i understand that (or whatever instead of
<%, including mustache-style{{). the point was to possibly make internal static server smarter to support templating