<html> <head> <title>Status</title> </head> <body> Status! websocket at /status/ws <ol id='msgs'> </ol> <script> let url = window.location.origin.replace('http', 'ws') +'/status/ws'; let el = document.getElementById("msgs") let socket = new WebSocket(url); socket.addEventListener('message', function(e){ let liEl = document.createElement('li'); liEl.innerHTML = e.data; el.appendChild(liEl); }); </script> </body> </html>