[BUG] Can't connect to websocket, The server returned status code '200' when status code '101' was expected
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
A quick note, it looks like TT is updating their backend requirements quickly and now the version may need to be 270000 .
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.
It is happening today... do you know wich is the current version?
It is happening today... do you know wich is the current version?
Not sure @somunich . It might be a slightly different issue though. About the time you responded to this the go library broke with the same error. The fix there was to change the "User-Agent" query parameter so it did not have Mozilla/ prepended for the wss:// url and that resolved the issue.