gobwas / ws

Tiny WebSocket library for Go.
MIT License
6.1k stars 373 forks source link

ReadFrame maxs out at 4096 lengths #183

Closed suffz closed 1 year ago

suffz commented 1 year ago

looking for a work around.

cristaloleg commented 1 year ago

Any details? Reproducer, version, whatever.

suffz commented 1 year ago
if payload, err := ws.ReadFrame(wsconn); err == nil {

Once the payload.Payload gets to around 4096 it maxs out and no new data is sent through afaik. im jw cause im using this for a websocket and the data can get up there and some of it is being cut off.

om26er commented 1 year ago

@suffz I think we need a real test case that can be used to reproduce the problem. Otherwise there definitely isn't going to be a workaround

suffz commented 1 year ago

Well, the max bytes I can receive from the ws stream appears to be 4096 and any data after that gets cut off completely.

The data goes beyond 4096 but because I can't retrieve the full data it sends incomplete responses.

cristaloleg commented 1 year ago

Aren't you experiencing https://pkg.go.dev/github.com/gobwas/ws#DefaultClientReadBufferSize ?

suffz commented 1 year ago

Most likely but I can't increase it because its a const.

cristaloleg commented 1 year ago

Yeah, but it's just a default, the real usage is here https://github.com/gobwas/ws/blob/fe40e5d87b2c7a74c6a202027ed76789fb3647fd/dialer.go#L58

Try to set higher value to these fields, this should help.

suffz commented 1 year ago

I could try, but I'm making my own ws connection and using that tls conn with this library to send / recv payloads.

The built in dialer wouldn't do much in this regard no?

suffz commented 1 year ago

Nvm, just saw the wrapconn func, i can try It out thanks.

cristaloleg commented 1 year ago

Please, share the results.

suffz commented 1 year ago

Alright, will do some tests after work.