socket.io-client-csharp icon indicating copy to clipboard operation
socket.io-client-csharp copied to clipboard

Connection hanging, not connecting

Open givowo opened this issue 1 year ago • 1 comments

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 :)

givowo avatar Jan 21 '24 22:01 givowo

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?

doghappy avatar Mar 26 '24 14:03 doghappy