Use secure websocket connection when loaded over HTTPS
This commit is contained in:
@@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
const playerId = namesSection.dataset.myId;
|
const playerId = namesSection.dataset.myId;
|
||||||
|
|
||||||
const socket = new WebSocket('ws://' + window.location.host + '/ws/' + encodeURIComponent(playerId));
|
const socket = new WebSocket((document.location.protocol.toLowerCase() === 'https:' ? 'wss' : 'ws') + '://' + window.location.host + '/ws/' + encodeURIComponent(playerId));
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", () => {
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
const next = document.querySelector('#controls .next');
|
const next = document.querySelector('#controls .next');
|
||||||
|
|||||||
Reference in New Issue
Block a user