Skip to content

Commit c53c89e

Browse files
committed
Add support for https connections to game-controller
1 parent 61afe3c commit c53c89e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,13 @@ if (process.env.NODE_ENV === 'development') {
5454
wsAddress = 'ws://localhost:8081/api/control';
5555
} else {
5656
// UI and backend are served on the same host+port on production builds
57-
wsAddress = 'ws://' + window.location.hostname + ':' + window.location.port + '/api/control';
57+
let protocol;
58+
if (window.location.protocol === 'http:') {
59+
protocol = 'ws:'
60+
} else {
61+
protocol = 'wss:'
62+
}
63+
wsAddress = protocol + '//' + window.location.hostname + ':' + window.location.port + '/api/control';
5864
}
5965

6066
// Connect to the backend with a single websocket that communicates with JSON format and is attached to the store

0 commit comments

Comments
 (0)