From 75ac1b17bfafa050fe64572b0302b3516873a7c5 Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Sat, 7 Dec 2013 10:06:10 -0800 Subject: [PATCH] fix: get correct transport when running on default port This fixes capturing manual browsers on Cloud9. Socket.io always uses port numbers in the active sockets map (even for default ports), so we need to append the port. I also changed to always use "http", as Karma does not support https and Cloud9 does (it uses a proxy), so the main frame is https, but the socket.io connection runs on unsecured http. --- src/adapter.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/adapter.js b/src/adapter.js index 379ee8a..5562000 100644 --- a/src/adapter.js +++ b/src/adapter.js @@ -35,7 +35,11 @@ var indexOf = function(collection, item) { var getCurrentTransport = function() { var parentWindow = window.opener || window.parent; var location = parentWindow.location; - var hostname = location.protocol + '//' + location.host; + var hostname = 'http://' + location.host; + + if (!location.port) { + hostname += ':80'; + } // Probably running in debug.html (there's no socket.io), // or in debug mode with socket.io but no socket on this host.