doghappy / socket.io-client-csharp

socket.io-client implemention for .NET
MIT License
715 stars 124 forks source link

Connection hanging, not connecting #352

Open givowo opened 5 months ago

givowo commented 5 months ago

I'm trying to use this library with unity, .Net Framework 4.7.2 My client code is

SocketIOClient.SocketIO client = new SocketIOClient.SocketIO("http://localhost:3000/");
client.OnConnected += async (sender, e) =>
{
   Debug.Log("connected");
};
await client.ConnectAsync();

and my server is

const httpServer = require("http").createServer();
const io = require("socket.io")(httpServer);

io.on("connection", (socket) => {
    console.log("connection");
});

io.listen(3000);

and the OnConnected callback is never called.

Turning on socket.io debug, I get these messages

 socket.io:server incoming connection with id c9nbGGFTm8ZkzJmkAAAC +4m
  socket.io:server incoming connection with id NqzWWA4ai2SYM4JzAAAD +72ms
  socket.io:client client close with reason transport close +3m
  socket.io:client no namespace joined yet, close the client +29s
  socket.io:client forcing transport close +0ms
  socket.io:client client close with reason forced server close +0ms

its trying to connect, but doesnt (for whatever reason)

help would be greatly appreciated :)

doghappy commented 3 months ago

Not sure what is the real reason. it would be better if you have a reproduce repo. what's the version of socket.io in your server?