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

Websocket recv() limited bytes returned #495

Open
johnraysimpson opened this issue Feb 4, 2025 · 4 comments
Open

Websocket recv() limited bytes returned #495

johnraysimpson opened this issue Feb 4, 2025 · 4 comments
Labels
question Ask for help or clarification websocket

Comments

@johnraysimpson
Copy link

The question

I have an issue with the websocket implementation, it seems that the recv() function can only return a maximum of 8192 bytes but I have a connection where the receive message is larger than this, I was wondering if there was a parameter I could use to increase/ignore that maximum?

Versions

  • OS: Windows 11
  • curl_cffi version 0.7.1
@johnraysimpson johnraysimpson added the question Ask for help or clarification label Feb 4, 2025
@johnraysimpson
Copy link
Author

johnraysimpson commented Feb 4, 2025

Oh I do see the remaining turns up eventually, I can probably handle that but thought it was worth mentioning. Takes a good 10 seconds to appear

@lexiforest
Copy link
Owner

Hi, can you have a look at #487, is this the same kind of issue?

@johnraysimpson
Copy link
Author

johnraysimpson commented Feb 5, 2025

Hey, I don't think so, my script doesn't really have points where recv() hangs and I'm utilising Websocket.run_forever() (I could try to see what happens when I use Websocket.recv() in a for loop to see if it's the same issue). I've traced it back to Curl.ws_recv() in curl.py where it chunks data up into 1024 bytes and collates them, but I can't see anything that is restricting the whole message. It just seems to gather the first 8192 bytes (which would be 8 iterations of Curl.ws_recv()), waits a while then sends the rest of the same message.
Fortunately this only happens at the start of my script, I can send some of it but it's a UK site and I'm not sure if it has location blocking.

EDIT:
Strangely enough, the remainder of the message is larger than 8192 so that's confusing

@johnraysimpson
Copy link
Author

Looking into this a bit further, what I've found is that if another, separate message comes through then the end of the last message is attached to the start of the new message, it comes through quicker but can be a bit irritating separating it all and making sure I have full messages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Ask for help or clarification websocket
Projects
None yet
Development

No branches or pull requests

2 participants