From 79756fdc63fe7b4e92fe0ca81b6503a77fe4149c Mon Sep 17 00:00:00 2001 From: Peter Portante Date: Wed, 26 Apr 2023 20:40:50 -0400 Subject: [PATCH] Use 1 MB buffers to avoid silent errors See https://github.com/r3labs/sse/issues/158, "Improve receive message error handling." Fixes https://github.com/chmouel/gosmee/issues/77, "`ERROR gosmee bufio.Scanner: token too long`". --- gosmee/client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gosmee/client.go b/gosmee/client.go index e925da7..4a1ea22 100644 --- a/gosmee/client.go +++ b/gosmee/client.go @@ -267,7 +267,7 @@ func (c goSmee) replayData(pm payloadMsg) error { func (c goSmee) clientSetup() error { version := strings.TrimSpace(string(Version)) fmt.Fprintf(os.Stdout, "%sStarting gosmee version: %s\n", c.emoji("⇉", "green+b"), version) - client := sse.NewClient(c.smeeURL) + client := sse.NewClient(c.smeeURL, sse.ClientMaxBufferSize(1<<20)) client.Headers["User-Agent"] = fmt.Sprintf("gosmee/%s", version) // this is to get nginx to work client.Headers["X-Accel-Buffering"] = "no"