aboutsummaryrefslogtreecommitdiffstats
path: root/static/scripts/spotify.js
diff options
context:
space:
mode:
Diffstat (limited to 'static/scripts/spotify.js')
-rw-r--r--static/scripts/spotify.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/static/scripts/spotify.js b/static/scripts/spotify.js
new file mode 100644
index 0000000..e6551a8
--- /dev/null
+++ b/static/scripts/spotify.js
@@ -0,0 +1,12 @@
+const connectWebsocket = () => {
+ document.getElementById('connection-status').innerHTML = "Connecting...";
+ let url = new URL(window.location.href);
+ url.protocol = url.protocol.replace('http', 'ws');
+ const socket = new WebSocket(url);
+ socket.onmessage = (event) => {
+ const data = JSON.parse(event.data);
+ console.log(data);
+ }
+}
+
+document.addEventListener("DOMContentLoaded", connectWebsocket);