Skip to content

Commit

Permalink
Merge pull request #21 from ksysoev/increase_max_message_size
Browse files Browse the repository at this point in the history
Set default maximum message size for WebSocket connection
  • Loading branch information
ksysoev authored Aug 20, 2024
2 parents 01d6895 + 131e203 commit 1d052e5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const (
// DefaultKeepAliveInterval is the default interval for sending ping requests to keep the connection alive.
defaultKeepAliveInterval = 25 * time.Second
defaultTimeout = 30 * time.Second
defaultMaxMessageSize = 1024 * 1024
)

// DerivAPI is the main struct for the DerivAPI client
Expand Down Expand Up @@ -161,6 +162,8 @@ func (api *Client) Connect() error {
return err
}

ws.SetReadLimit(defaultMaxMessageSize)

if resp.Body != nil {
defer resp.Body.Close()
}
Expand Down
2 changes: 1 addition & 1 deletion examples/tick_history/tick_history.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func main() {
End: "latest",
Start: &start,
Style: "ticks",
Count: 10})
Count: 5000})

if err != nil {
log.Fatal(err)
Expand Down

0 comments on commit 1d052e5

Please sign in to comment.