diff --git a/client-src/default/utils/createSocketUrl.js b/client-src/default/utils/createSocketUrl.js index b14e6136cb..d85f546159 100644 --- a/client-src/default/utils/createSocketUrl.js +++ b/client-src/default/utils/createSocketUrl.js @@ -3,41 +3,60 @@ /* global self */ const url = require('url'); -const querystring = require('querystring'); const getCurrentScriptSource = require('./getCurrentScriptSource'); -function createSocketUrl(resourceQuery) { +function createSocketUrl(resourceQuery, currentLocation) { let urlParts; if (typeof resourceQuery === 'string' && resourceQuery !== '') { // If this bundle is inlined, use the resource query to get the correct url. - // strip leading `?` from query string - urlParts = url.parse(resourceQuery.substr(1)); + // format is like `?http://0.0.0.0:8096&sockPort=8097&sockHost=localhost` + urlParts = url.parse( + resourceQuery + // strip leading `?` from query string to get a valid URL + .substr(1) + // replace first `&` with `?` to have a valid query string + .replace('&', '?'), + true + ); } else { // Else, get the url from the