add exceptions for finished games

This commit is contained in:
filifa 2024-07-20 15:04:19 -05:00
parent 5e471f5c2c
commit be70ee7330
2 changed files with 6 additions and 1 deletions

View File

@ -26,6 +26,11 @@ type Push struct {
UpdateId string
}
const (
GameFinalCode = 4200
GameUnavailableCode = 4400
)
type GamedayWebsocket struct {
baseURL url.URL
*websocket.Conn

View File

@ -88,7 +88,7 @@ func subscribe(cmd *cobra.Command, args []string) {
var p statsapi.Push
err = ws.ReadJSON(&p)
if websocket.IsUnexpectedCloseError(err) {
if websocket.IsUnexpectedCloseError(err, statsapi.GameFinalCode, statsapi.GameUnavailableCode) {
log.Println(err)
ws.Close()