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

[BUG] Can't connect to websocket, The server returned status code '200' when status code '101' was expected #108

Open
steampoweredtaco opened this issue Jan 28, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@steampoweredtaco
Copy link

steampoweredtaco commented Jan 28, 2025

A recent TikTok changed broke websocket connections that do not include version_code=180800 in the query parameters for the websocket url. This is breaking everyone's C# clients.

The library seems like it might be reusing the headers that it also uses for the web client which breaks with version_code in it (that was another bug we fixed recently).

A gross hack that fixes this that I confirmed on my end:

diff --git a/TikTokLiveSharp/Client/TikTokBaseClient.cs b/TikTokLiveSharp/Client/TikTokBaseClient.cs
index 23bbbc3..d912869 100644
--- a/TikTokLiveSharp/Client/TikTokBaseClient.cs
+++ b/TikTokLiveSharp/Client/TikTokBaseClient.cs
@@ -550,6 +550,7 @@ namespace TikTokLiveSharp.Client
                 clientParams["cursor"] = response.Cursor;
                 clientParams["resp_content_type"] = "protobuf";
                 clientParams["internal_ext"] = response.InternalExt;
+                clientParams["version_code"] = "270000";
                 foreach (KeyValuePair<string, string> param in response.RouteParamsMap)
                 {
                     if (ShouldLog(LogLevel.Verbose))

I'm sure there is a better way to fix the code, but I'll leave it to ya'll @frankvHoof93

@steampoweredtaco steampoweredtaco added the bug Something isn't working label Jan 28, 2025
@steampoweredtaco
Copy link
Author

A quick note, it looks like TT is updating their backend requirements quickly and now the version may need to be 270000 .

@steampoweredtaco
Copy link
Author

Another note, it appears that the required value depends on knowledge only know to eulerstream... so we probably should hold off on patching this until we know the full story/fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant