Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: make an option to provide buffer size for client scanner #97

Open
Venoox opened this issue Oct 2, 2021 · 5 comments
Open

Feature: make an option to provide buffer size for client scanner #97

Venoox opened this issue Oct 2, 2021 · 5 comments

Comments

@Venoox
Copy link

Venoox commented Oct 2, 2021

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?

@codewinch
Copy link
Contributor

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)

@Venoox
Copy link
Author

Venoox commented Nov 6, 2021

Yes, exactly

@purehyperbole
Copy link
Member

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?

@purehyperbole
Copy link
Member

@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

@portante
Copy link

This fixes chmouel/gosmee#77.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants