diff --git a/api.go b/api.go index 2e7d385..b113343 100644 --- a/api.go +++ b/api.go @@ -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 @@ -161,6 +162,8 @@ func (api *Client) Connect() error { return err } + ws.SetReadLimit(defaultMaxMessageSize) + if resp.Body != nil { defer resp.Body.Close() } diff --git a/examples/tick_history/tick_history.go b/examples/tick_history/tick_history.go index 5cb4fe0..099edc6 100644 --- a/examples/tick_history/tick_history.go +++ b/examples/tick_history/tick_history.go @@ -27,7 +27,7 @@ func main() { End: "latest", Start: &start, Style: "ticks", - Count: 10}) + Count: 5000}) if err != nil { log.Fatal(err)