Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Commit 7437f8f

Browse files
authored
update support for wss (#122)
Signed-off-by: Caroline Church <[email protected]>
1 parent 9a10285 commit 7437f8f

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

packages/vehicle-manufacture-manufacturing/client/app/views/dashboard/dashboard.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ angular.module('bc-manufacturer')
105105
}
106106
console.log(' Connecting to websocket', wsUri);
107107
var webSocketURL = wsUri;
108-
let websocket = new WebSocket(webSocketURL);
108+
var websocket = new WebSocket(webSocketURL);
109109
websocket.onopen = function () {
110110
console.log('Websocket is open');
111111
}

packages/vehicle-manufacture-vda/client/app/directives/header/header.directive.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ angular.module('bc-vda')
3737
return route === location.path();
3838
}
3939

40-
let destroyed = false;
41-
let websocket;
40+
var destroyed = false;
41+
var websocket;
4242

4343
function openWebSocket() {
4444
var wsUri = '';

packages/vehicle-manufacture-vda/client/app/views/dashboard/dashboard.controller.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,16 @@ angular.module('bc-vda')
8484

8585
// Websockets
8686
var destroyed = false;
87-
let websocket;
87+
var websocket;
8888
function openWebSocket() {
89-
var webSocketURL = 'ws://' + location.host;
89+
var wsUri = '';
90+
if (location.protocol === 'https:') {
91+
wsUri = 'wss://' + location.host;
92+
} else {
93+
wsUri = 'ws://' + location.hostname + ':' + location.port;
94+
}
95+
console.log(' Connecting to websocket', wsUri);
96+
var webSocketURL = wsUri;
9097
websocket = new WebSocket(webSocketURL);
9198

9299
websocket.onopen = function () {

0 commit comments

Comments
 (0)