socket.io-client-csharp
socket.io-client-csharp copied to clipboard
cannot connect to glitch or heroku
its work for localhost or ipadress:port.. but not work for glitch or heroku.. not work for remote server
This error is solved now?
If someone is able to resolve this or found a different solution/library then, please reply. It would be really helpful.
Is there a service available for testing?
I have just tried to create a socket.io server on glitch, then use this lib to connect. It seems that glitch require a User-Agent header
using var io = CreateSocketIO();
io.Options.ExtraHeaders = new Dictionary<string, string>()
{
["User-Agent"] =
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36 Edg/110.0.1587.50",
};
await io.ConnectAsync();
I have tried with above code, but I got same error result.
I've fixed it, need to do this in 3.0.8
using var io = CreateSocketIO();
io.Options.AutoUpgrade = false;
io.Options.ExtraHeaders = new Dictionary<string, string>()
{
["User-Agent"] =
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36 Edg/110.0.1587.50",
};
await io.ConnectAsync();
reasons:
- glitch required a User-Agent header.
- could not connect socket.io server by ws if socket.io hosted on glitch
I deployed socket server on aws. other clients(python, nodejs, java) are running well. but only C# has an error.