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 connection failed, Error: Expected a Sec-WebSocket-Protocol header. #175

Open
valmir123 opened this issue Mar 21, 2024 · 6 comments

Comments

@valmir123
Copy link

Hi

Would someone know why I'm getting the following error all of a sudden while it has been working for months when I try to scrape data of presents that are being send in the live:

General error! {
info: 'Upgrade to websocket failed',
exception: 'Websocket connection failed, Error: Expected a Sec-WebSocket-Protocol header.'
}

Thanks in advance and kind regards

@esalvi
Copy link

esalvi commented Mar 21, 2024

Same error from today

@adierebel
Copy link

Upgrade to latest commit

@valmir123
Copy link
Author

Upgrade to latest commit

Thx! It works again.

@esalvi
Copy link

esalvi commented Mar 24, 2024

Upgrade to latest commit

Thank you! It works

@Zansabar
Copy link

After 2 months with that Parse Error issue and realizing that it was my fault for not keeping my Node JS up to date with the latest version (upgraded to 21) - I've now upgraded my error status to this one. I've updated to latest commit on the library and I'm getting the combo info: 'Upgrade to websocket failed',
exception: 'Websocket connection failed, Error: Expected a Sec-WebSocket-Protocol header.' and then followed by

Error while connecting, Error: TikTok does not offer a websocket upgrade. Please provide a valid sessionId to use request polling instead.
{
info: 'Error while connecting',
exception: Error: TikTok does not offer a websocket upgrade. Please provide a valid sessionId to use request polling instead.
at WebcastPushConnection.connect (node_modules\tiktok-live-connector\dist\index.js:287:17)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
}

I used to have the .env file with the Sessionid and the ttwid - and thought that was the issue. I removed that. And upgraded to the latest commit. Same issue.

Wondering if this is a real issue or has something to do with the sig server and too many requests?

@Zansabar
Copy link

Okay, after a combination sequences of fresh downloads of the tiktok-live-connector to a different directory on my PC and clearing and restoring from backup and running npm update and npm i tikok-live-connector command on it and manually copying and pasting on top of the existing code in node_modules\tiktok-live-connector
I finally - Finally, -- FINALLY got the connector to work!
And was able to go live for an hour with solid chat, gifts, and like events being delivered to my custom game. (and happy followers rejoicing they could PLAY again after a 2 month hiatus - that's what this is all about, right? Bring joy to others through our crafts)
And then, no more than 15 hours later. I'm getting that Connection failed, Error: Missing cursor in initial fetch response and then the 429 error that means I gotta wait to try again.
I'm starting to think that the Connection failed, Error: Missing cursor in initial fetch response isn't me, it is the euler server with either too many connections of some random error that might be unhandled. Not sure. Unless TikTok did change something in 15 hours. There is no commits that I am aware of.
Just doing my QA and code testing here trying to get an answer.

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