X-Git-Url: https://code.octet-stream.net/broadcaster/blobdiff_plain/8f9b19f7877e32c15a5f4c296d6738f449dfcc19..8320951221d45c5f5f3d387c5cb4b97d9fa2094c:/protocol/protocol.go?ds=inline diff --git a/protocol/protocol.go b/protocol/protocol.go index d168bc3..e23da3a 100644 --- a/protocol/protocol.go +++ b/protocol/protocol.go @@ -19,6 +19,7 @@ const ( FilesType = "files" PlaylistsType = "playlists" + StopType = "stop" // Status values @@ -52,6 +53,11 @@ type PlaylistsMessage struct { Playlists []PlaylistSpec } +// Any playlist currently being played should be stopped and PTT disengaged. +type StopMessage struct { + T string +} + type StatusMessage struct { T string @@ -148,5 +154,14 @@ func ParseMessage(data []byte) (string, interface{}, error) { return t.T, status, nil } + if t.T == StopType { + var stop StopMessage + err = json.Unmarshal(data, &stop) + if err != nil { + return "", nil, err + } + return t.T, stop, nil + } + return "", nil, errors.New(fmt.Sprintf("unknown message type %v", t.T)) }