diff --git a/ui/html/game.page.tmpl.html b/ui/html/game.page.tmpl.html
index e527265..800fad0 100644
--- a/ui/html/game.page.tmpl.html
+++ b/ui/html/game.page.tmpl.html
@@ -41,7 +41,7 @@
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');