This commit is contained in:
XenGi 2023-11-07 21:17:20 +01:00
parent 632ece25c9
commit 6669e0ce77
Signed by: xengi
SSH key fingerprint: SHA256:FGp51kRvGOcWnTHiOI39ImwVO4A3fpvR30nPX3LpV7g

View file

@ -1,6 +1,8 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html lang="en">
<head> <head>
<meta charset="utf-8">
<title>WebSocket</title>
<style> <style>
body { body {
display: grid; display: grid;
@ -125,6 +127,24 @@
<div class="tabs"></div> <div class="tabs"></div>
<div class="result"></div> <div class="result"></div>
</section> </section>
<footer class="footer"></footer> <footer class="footer">
<p id="console"></p>
</footer>
<script>
const loc = window.location;
const proto = loc.protocol === "https:" ? "wss:" : "ws:"
const ws = new WebSocket(proto + "//" + loc.host + "/ws")
ws.onopen = function() {
console.log("Connected")
}
ws.onmessage = function(evt) {
const out = document.getElementById("console");
out.innerHTML += evt.data + "<br>";
// TODO: react on MPD communication here
// TODO: react on yt-dlp communication here
}
</script>
</body> </body>
</html> </html>