Skip to content

Commit

Permalink
Bitfinex: Handle conf and info WS channel events
Browse files Browse the repository at this point in the history
  • Loading branch information
gbjk committed Oct 5, 2023
1 parent 40c42e5 commit 872499d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions exchanges/bitfinex/bitfinex_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,8 @@ const (
wsEventUnsubscribed = "unsubscribed"
wsEventAuth = "auth"
wsEventError = "error"
wsEventConf = "conf"
wsEventInfo = "info"
)

// WsAuthRequest container for WS auth request
Expand Down
11 changes: 11 additions & 0 deletions exchanges/bitfinex/bitfinex_websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,17 @@ func (b *Bitfinex) handleWSEvent(respRaw []byte) error {
}
return fmt.Errorf("WS auth subscription error; Status: %s Error Code: %d", status, errCode)
}
case wsEventInfo:
// Nothing to do with info for now.
// version or platform.status might be useful in the future.
case wsEventConf:
status, err := jsonparser.GetUnsafeString(respRaw, "status")
if err != nil {
return fmt.Errorf("error parsing WS configure channel event status: %w from message: %s", err, respRaw)
}
if status != "OK" {
return fmt.Errorf("WS configure channel error; Status: %s", status)
}
default:
return fmt.Errorf("unknown WS event msg: %s", respRaw)
}
Expand Down

0 comments on commit 872499d

Please sign in to comment.