sse
sse copied to clipboard
Feature: make an option to provide buffer size for client scanner
I'm trying to use client from this module and the problem I keep having is that the buffer is too small because server is sending events with data larger than max token size from bufio (MaxScanTokenSize). I can also code this feature and make a PR but I'm not sure what's the best way to go about it. Would you be interested in adding this feature?
Are you saying that, in client mode, a server that is outside of your control is sending events that are larger than 64 KB? (https://pkg.go.dev/bufio#pkg-constants)
Yes, exactly
Hey @Venoox , very sorry for not getting back to you sooner!
I think this sounds like a good feature to have. If you still have a need for it, I can try to implement some options for MaxScanTokenSize
, unless you would prefer to give it a go?
@Venoox You should now be able to configure the bufio scanner size in 2.7.0
like so:
// sets the buffer size to 1 << 19 (524288 bytes)
c := sse.NewClient(url, sse.ClientMaxBufferSize(1<<19))
Please let me know if this has fixed your issue
This fixes https://github.com/chmouel/gosmee/issues/77.