Fixes a problem with the resource path of socket.io

pull/35/head
Peter 'Pita' Martischka 2011-07-06 19:51:41 +02:00
parent 068d174c58
commit ac1858f8ec
2 changed files with 4 additions and 3 deletions

View File

@ -66,8 +66,9 @@ function handshake()
//create the url //create the url
var url = loc.protocol + "//" + loc.hostname + ":" + port + "/"; var url = loc.protocol + "//" + loc.hostname + ":" + port + "/";
//find out in which subfolder we are //find out in which subfolder we are
var resource = loc.pathname.substring(0,loc.pathname.indexOf("/p/")) + "/socket.io"; console.log(loc.pathname);
var resource = loc.pathname.substr(1,loc.pathname.indexOf("/p/")) + "socket.io";
console.log(resource);
//connect //connect
socket = io.connect(url, {resource: resource}); socket = io.connect(url, {resource: resource});

View File

@ -75,7 +75,7 @@
//create the url //create the url
var url = loc.protocol + "//" + loc.hostname + ":" + port + "/"; var url = loc.protocol + "//" + loc.hostname + ":" + port + "/";
//find out in which subfolder we are //find out in which subfolder we are
var resource = loc.pathname.substring(0,loc.pathname.indexOf("/p/")) + "/socket.io"; var resource = loc.pathname.substr(1,loc.pathname.indexOf("/p/")) + "socket.io";
//build up the socket io connection //build up the socket io connection
socket = io.connect(url, {resource: resource}); socket = io.connect(url, {resource: resource});