Set higher websocket read limit

This commit is contained in:
DataHoarder 2023-04-28 10:26:32 +02:00
parent 0d556e1ad7
commit 25e5c06246
Signed by: DataHoarder
SSH key fingerprint: SHA256:OLTRf6Fl87G52SiR7sWLGNzlJt4WOX+tfI2yxo0z7xk

View file

@ -126,6 +126,8 @@ func (c *channelEntry) getPreviousBlocks() {
c.PreviousBlocks = result
}
const readLimit = 8 * 1024 * 1024
func (c *channelEntry) openWebSocket() {
if c.ApiEndpoint == "" {
c.Ws.Store(nil)
@ -141,6 +143,7 @@ func (c *channelEntry) openWebSocket() {
c.Ws.Store(nil)
return
}
conn.SetReadLimit(readLimit)
c.Ws.Store(conn)
} else {
conn, _, err := websocket.Dial(ctx, fmt.Sprintf("ws://%s/api/events", u.Host), nil)
@ -148,6 +151,7 @@ func (c *channelEntry) openWebSocket() {
c.Ws.Store(nil)
return
}
conn.SetReadLimit(readLimit)
c.Ws.Store(conn)
}
}