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

风流意气都作罢 提交于 2019-12-02 13:24:57

问题


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!


回答1:


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:

  • demo 1

  • demo 2

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 contact@xsockets.net if you want in!



来源:https://stackoverflow.com/questions/24565961/is-socket-io-client-adequate-as-a-socket-client-for-xsockets-net-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!