Skip to content

Commit

Permalink
Use secure websocket connection when loaded over HTTPS
Browse files Browse the repository at this point in the history
  • Loading branch information
vojta001 committed Apr 25, 2021
1 parent 9f9f5fa commit 7a94ba8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ui/html/game.page.tmpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ <h1 class="question"></h1>

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", () => {
const next = document.querySelector('#controls .next');
Expand Down

0 comments on commit 7a94ba8

Please sign in to comment.