问题描述
我开发C#服务器和客户端的Node.js之间的一些插座桥梁。
I develop a some socket bridge between C# server and node.js client.
首先,我想用传统的TCP / IP套接字,但转念一想的WebSocket在节点的异步编程风格太容易。
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看起来不错,干净,我会用它作为一个WebSocket的服务器。
XSockets.NET looks good and clean, and I will use it as a websocket server.
我知道 WS
广泛用于节点基本的WebSocket层,但我们有socket.io或engine.io。我不知道是否是一个正确的选择,因为套接字客户端,并且希望仔细检查我错过了。
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?
也许,任何不需要抽象层,我应该只使用 WS
..
Perhaps, any abstract layer is not needed, and I should use only ws
..
谢谢!
推荐答案
如果您正在使用XSockets.NET作为服务器,你可以连接任何插口到服务器。你没有说话的WebSockets。实际上,你可以使用Node.js的插座来连接和发送数据。
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.
这样做的关键是要实现自定义的协议。只要您发送JSON是很简单的。只是继承创建由XSockets.NET
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:
编辑:如果你是刚开始接触这个项目我会建议你加入了测试组XSockets.NET 4.0 XSockets的下一代是在3 *版本很多很多的改善。只需发送邮件到[email protected]~~V如果你想要的!
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!
这篇关于是socket.io客户端足够的套接字客户端XSockets.NET服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!