]> code.octet-stream.net Git - broadcaster/blobdiff - server/radio_sync.go
Clean up log entries
[broadcaster] / server / radio_sync.go
index 9fd9a658a834622b8b4a02b560e963b01a231445..6eefc8b2785fe7fbd96c720e001dad714b8c6f65 100644 (file)
@@ -1,14 +1,14 @@
 package main
 
 import (
 package main
 
 import (
-       "code.octet-stream.net/broadcaster/protocol"
+       "code.octet-stream.net/broadcaster/internal/protocol"
        "encoding/json"
        "golang.org/x/net/websocket"
        "log"
 )
 
 func RadioSync(ws *websocket.Conn) {
        "encoding/json"
        "golang.org/x/net/websocket"
        "log"
 )
 
 func RadioSync(ws *websocket.Conn) {
-       log.Println("A websocket connected, I think")
+       log.Println("Radio websocket connected, not yet authenticated")
        buf := make([]byte, 16384)
 
        badRead := false
        buf := make([]byte, 16384)
 
        badRead := false
@@ -53,6 +53,8 @@ func RadioSync(ws *websocket.Conn) {
                        radio = r
                        log.Println("Radio authenticated:", radio.Name)
                        isAuthenticated = true
                        radio = r
                        log.Println("Radio authenticated:", radio.Name)
                        isAuthenticated = true
+                       commandRouter.AddWebsocket(r.Id, ws)
+                       defer commandRouter.RemoveWebsocket(ws)
 
                        go KeepFilesUpdated(ws)
                        go KeepPlaylistsUpdated(ws)
 
                        go KeepFilesUpdated(ws)
                        go KeepPlaylistsUpdated(ws)