5 <meta name=
"viewport" content=
"width=device-width, initial-scale=1.0">
6 <title>Broadcaster
</title>
7 <style type=
"text/css">
8 table.radio-status, td.outer {
12 border-collapse: collapse;
38 <script type=
"text/javascript">
39 function connectWebsocket() {
40 console.log(
"Attempting to create websocket connection for radio status sync")
41 const cookieValue = document.cookie
43 .find((row) =
> row.startsWith(
"broadcast_session="))
45 const socket = new WebSocket(
"/websync");
46 socket.addEventListener(
"open", (event) =
> {
47 socket.send(cookieValue);
49 socket.addEventListener(
"message", (event) =
> {
50 console.log(
"Received a status update from server")
51 const connected = document.getElementById('connected-radios');
52 connected.innerHTML = event.data;
54 socket.addEventListener(
"close", (event) =
> {
55 console.log(
"Websocket closed. Will retry in 10 seconds.")
56 setTimeout(connectWebsocket,
10000);
59 // initial connection on page load
67 <p>Your username is: {{.Username}}.
</p>
68 <p><a href=
"/logout">Log Out
</a></p>
70 <p><a href=
"/login">Log In
</a></p>
72 <p><a href=
"/file/">File Management
</a></p>
73 <p><a href=
"/playlist/">Playlist Management
</a></p>
74 <p><a href=
"/radio/">Radio Management
</a></p>
75 <h2>Connected Radios
</h2>
76 <div id=
"connected-radios">