Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion html/rfid.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ function initWebSocket() {
}

try {
socket = new WebSocket('ws://' + window.location.host + '/ws');
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
socket = new WebSocket(protocol + '//' + window.location.host + '/ws');

socket.onopen = function() {
isConnected = true;
Expand Down
3 changes: 2 additions & 1 deletion html/upgrade.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ <h2>2) Webpage Update</h2>
let wsReconnectTimer = null;

function connectWebSocket() {
ws = new WebSocket('ws://' + window.location.host + '/ws');
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
ws = new WebSocket(protocol + '//' + window.location.host + '/ws');

ws.onmessage = function(event) {
try {
Expand Down
3 changes: 2 additions & 1 deletion html/waage.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ <h5 class="card-title">Calibration done</h5>
const statusMessage = document.getElementById('statusMessage');

function connectWebSocket() {
ws = new WebSocket(`ws://${window.location.hostname}/ws`);
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
ws = new WebSocket(`${protocol}//${window.location.host}/ws`);

ws.onopen = () => {
console.log('WebSocket verbunden');
Expand Down