diff --git a/server/index.html b/server/index.html index 3863143..3a23585 100644 --- a/server/index.html +++ b/server/index.html @@ -94,7 +94,7 @@ if (!topicEntry) { topicEntry = document.createElement('li'); topicEntry.id = `topic-${topic}`; - topicEntry.innerHTML = `${topic} `; + topicEntry.innerHTML = `${topic} `; topicsList.appendChild(topicEntry); } topicsHeader.style.display = ''; @@ -102,12 +102,12 @@ // Open event source let eventSource = new EventSource(`${topic}/sse`); eventSource.onopen = () => { - topicEntry.innerHTML = `${topic} `; + topicEntry.innerHTML = `${topic} `; delaySec = 0; // Reset on successful connection }; eventSource.onerror = (e) => { - const newDelaySec = (delaySec + 5 <= 30) ? delaySec + 5 : 30; - topicEntry.innerHTML = `${topic} (Reconnecting in ${newDelaySec}s ...) `; + const newDelaySec = (delaySec + 5 <= 15) ? delaySec + 5 : 15; + topicEntry.innerHTML = `${topic} (Reconnecting in ${newDelaySec}s ...) `; eventSource.close() subscribeInternal(topic, newDelaySec); }; @@ -130,6 +130,13 @@ } }; + const test = (topic) => { + fetch(`/${topic}`, { + method: 'PUT', + body: `This is a test notification for topic ${topic}!` + }) + }; + const showError = (msg) => { errorField.innerHTML = msg; topicField.disabled = true;