@@ -99,10 +99,12 @@ func parseWebSocketEvent(in []byte) (interface{}, error) {
99
99
type WsEventType string
100
100
101
101
const (
102
- WsEventTypeLogin = "login"
103
- WsEventTypeError = "error"
104
- WsEventTypeSubscribe = "subscribe"
105
- WsEventTypeUnsubscribe = "unsubscribe"
102
+ WsEventTypeLogin WsEventType = "login"
103
+ WsEventTypeError WsEventType = "error"
104
+ WsEventTypeSubscribe WsEventType = "subscribe"
105
+ WsEventTypeUnsubscribe WsEventType = "unsubscribe"
106
+ WsEventTypeConnectionInfo WsEventType = "channel-conn-count"
107
+ WsEventTypeConnectionError WsEventType = "channel-conn-count-error"
106
108
)
107
109
108
110
type WebSocketEvent struct {
@@ -115,6 +117,8 @@ type WebSocketEvent struct {
115
117
} `json:"arg,omitempty"`
116
118
Data json.RawMessage `json:"data"`
117
119
ActionType ActionType `json:"action"`
120
+ Channel Channel `json:"channel"`
121
+ ConnCount string `json:"connCount"`
118
122
}
119
123
120
124
func (w * WebSocketEvent ) IsValid () error {
@@ -133,6 +137,12 @@ func (w *WebSocketEvent) IsValid() error {
133
137
}
134
138
return nil
135
139
140
+ case WsEventTypeConnectionInfo :
141
+ return nil
142
+
143
+ case WsEventTypeConnectionError :
144
+ return fmt .Errorf ("connection rate limit exceeded, channel: %s, connCount: %s" , w .Channel , w .ConnCount )
145
+
136
146
default :
137
147
return fmt .Errorf ("unexpected event type: %+v" , w )
138
148
}
@@ -401,3 +411,10 @@ func (m *MarketTradeEvent) toGlobalTrade() (types.Trade, error) {
401
411
FeeCurrency : "" , // not supported
402
412
}, nil
403
413
}
414
+
415
+ type ConnectionInfoEvent struct {
416
+ Event string `json:"event"`
417
+ Channel Channel `json:"channel"`
418
+ ConnCount string `json:"connCount"`
419
+ ConnId string `json:"connId"`
420
+ }
0 commit comments