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

How to increase the 65K message limit on the receiving side? #32

Closed
hspaay opened this issue May 18, 2024 · 3 comments
Closed

How to increase the 65K message limit on the receiving side? #32

hspaay opened this issue May 18, 2024 · 3 comments

Comments

@hspaay
Copy link

hspaay commented May 18, 2024

I'm attempting to use go-sse in the hiveot project (iot digital twin hub) and ran into a limitation when pushing messages from the hub to a client via SSE. Everything works well when the messages are smaller than 65K. When they exceed 65K they never arrive. The sending side however does not report any error.

Some digging found that Connection.read() creates parser.New(), which calls bufio.NewScanner() which sets a default buffer of MaxScanTokenSize, which is indeed 65K.

Scanner.Buffer seems to be the way to change this buffer. However I don't see a way to do this in between Connection.read() and the start of scanning.

What is the intended way to change the buffer size after creating a connection?

@hspaay hspaay changed the title How to increase the 64K message limit on the receiving side? How to increase the 65K message limit on the receiving side? May 18, 2024
@tmaxmax
Copy link
Owner

tmaxmax commented May 18, 2024

Hi there and thank you for raising the issue!

You've correctly identified that at the moment there isn't a way to set the internal buffer. I'll push a new version which will add the sse.Connection.Buffer(buf []byte, maxSize int) method to support this.

In the meantime I'm thinking of overhauling the SSE client completely. At least from the issues raised up until this point it seems as if most usage of this library is concerned with the client and I think the experience could be better. Would it be too much to ask for some feedback on the new client proposal? Setting the read buffer would probably be an option on sse.ConnectConfig.

Nevertheless I'll let you know when the update is pushed.

@tmaxmax
Copy link
Owner

tmaxmax commented May 18, 2024

Here it is, please let me know if v0.9.0-pre.2 solves your use case! Feel free to close the issue yourself if everything works.

@hspaay
Copy link
Author

hspaay commented May 18, 2024

Wow that was fast. Better yet, it works like a charm! Thank you so much.

I will take a look at the client proposal.
Thanks again!

@hspaay hspaay closed this as completed May 18, 2024
@tmaxmax tmaxmax mentioned this issue Aug 24, 2024
29 tasks
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

2 participants