Socket.io nodejs server .NET connection

17 Views Asked by At

I'm trying to connect to a nodejs socket.io server with c# using this Client-CSharp solution.

And it connects when im using only "http"-protocol and NOT use hostname-argument in listen method. I use an SSL certificate and I get a 404 error for http requests (if from a browser, https is ok). But everything works with the socket.

Exaple

Working when nodejs server

server.listen(port,  () => {
   console.log('running');
});

.NET

var client = new SocketIOClass("http://serverdomain.com:2222");

And not working when sometning on server/client side changes nodejs

const hostname = '127.0.0.1';
server.listen(port, hostname,   () => {
   console.log('running');
});

or https .NET

var client = new SocketIOClass("https://serverdomain.com:2222");

How it works? And how critical is specifying the hostname? Does using HTTP in this case for sockets mean insecure transmission? I'm absolutely confused.

Tried using different libraries but the end result is the same (remove hostname and its works).

0

There are 0 best solutions below