add exceptions for finished games
This commit is contained in:
parent
5e471f5c2c
commit
be70ee7330
|
@ -26,6 +26,11 @@ type Push struct {
|
||||||
UpdateId string
|
UpdateId string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
GameFinalCode = 4200
|
||||||
|
GameUnavailableCode = 4400
|
||||||
|
)
|
||||||
|
|
||||||
type GamedayWebsocket struct {
|
type GamedayWebsocket struct {
|
||||||
baseURL url.URL
|
baseURL url.URL
|
||||||
*websocket.Conn
|
*websocket.Conn
|
||||||
|
|
|
@ -88,7 +88,7 @@ func subscribe(cmd *cobra.Command, args []string) {
|
||||||
|
|
||||||
var p statsapi.Push
|
var p statsapi.Push
|
||||||
err = ws.ReadJSON(&p)
|
err = ws.ReadJSON(&p)
|
||||||
if websocket.IsUnexpectedCloseError(err) {
|
if websocket.IsUnexpectedCloseError(err, statsapi.GameFinalCode, statsapi.GameUnavailableCode) {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
ws.Close()
|
ws.Close()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue