Search code examples
c#node.jssocketswebsocketxsockets.net

Is socket.io-client adequate as a socket client for XSockets.NET server?


I develop a some socket bridge between C# server and node.js client.

Firstly, I thought to use legacy TCP/IP socket, but on second thought websocket is way too easier in async style programming of node.

XSockets.NET looks good and clean, and I will use it as a websocket server.

I know ws is widely used for fundamental websocket layer for node, but we have socket.io or engine.io. I wonder if socket.io-client is a proper choice as a socket client, and want to double check what I miss.

Do you have any other option in this case?

Perhaps, any abstract layer is not needed, and I should use only ws..

Thanks!


Solution

  • If you are using XSockets.NET as a server you can connect any socket to the server. You do not have to talk websockets. You can actually use the Node.JS socket to connect and send data.

    The trick to do so is to implement a custom protocol. As long as you send JSON it is very simple. Just inherit create a new protocol from the protocol-template provided by XSockets.NET

    These short demos might explain more in detail:

    EDIT: If you are just getting started with the project I would recomend you to join the group that test XSockets.NET 4.0 The next gen of XSockets is much much improved over the 3.* versions. Just send a mail to [email protected] if you want in!