Skip to content

Commit

Permalink
Support empty params for websocket endpoint (#2111)
Browse files Browse the repository at this point in the history
  • Loading branch information
dydxwill committed Aug 26, 2024
1 parent 086e07c commit a2bf192
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions protocol/streaming/ws/websocket_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ func (ws *WebsocketServer) Handler(w http.ResponseWriter, r *http.Request) {
// parseSubaccountIds is a helper function to parse the subaccountIds from the query parameters.
func parseSubaccountIds(r *http.Request) ([]*satypes.SubaccountId, error) {
subaccountIdsParam := r.URL.Query().Get("subaccountIds")
if subaccountIdsParam == "" {
return []*satypes.SubaccountId{}, nil
}
idStrs := strings.Split(subaccountIdsParam, ",")
subaccountIds := make([]*satypes.SubaccountId, 0)
for _, idStr := range idStrs {
Expand All @@ -128,6 +131,9 @@ func parseSubaccountIds(r *http.Request) ([]*satypes.SubaccountId, error) {
// parseClobPairIds is a helper function to parse the clobPairIds from the query parameters.
func parseClobPairIds(r *http.Request) ([]uint32, error) {
clobPairIdsParam := r.URL.Query().Get("clobPairIds")
if clobPairIdsParam == "" {
return []uint32{}, nil
}
idStrs := strings.Split(clobPairIdsParam, ",")
clobPairIds := make([]uint32, 0)
for _, idStr := range idStrs {
Expand Down

0 comments on commit a2bf192

Please sign in to comment.