Node.Js + Socket.IO vs SignalR vs C# WebSocket Server

前端 未结 3 727
深忆病人
深忆病人 2020-12-07 08:55

I currently have a TCP server application written in .Net that receives and submits messages to clients. I am looking at building a web application so need the communication

相关标签:
3条回答
  • 2020-12-07 09:12

    Other implications

    I've used both technologies and work on both sides of the .NET / node stacks.

    1. Although I prefer the node side these days, if you only work in .NET, SignalR is the obvious choice. Conversely, if you build all your projects in node I would go with socket.io or sockjs. If your scope is narrow enough that you don't need to worry about fallbacks and that sort of thing, I'd recommend checking out ws module since its simpler and lighter on your dependencies. In the past, socket.io has been a pain on Windows due to install issues with node-gyp failing to install native dependencies (node-gyp requires many configuration steps that vary wildly depending on which version of Windows you have but is required for C++ native built modules). UPDATE This Windows bit is not so much relevant anymore thanks to windows-build-tools.
    2. If you have a load balancer and are planning on running SignalR, you are going to need to setup SQL or Redis as a backplane to bypass the load balancer. You will have similar issues to deal with on the socket.io side and there are [multiple supported methods][1] (1 of which is redis also).

    Update - removed jquery info since it is no longer applicable

    0 讨论(0)
  • 2020-12-07 09:25

    Developing a scalable / thread safe TCP server may not be an easy task. On the other hand, there are very nice resources on the internet in order to start your own. For example, if you are just looking for some nice open source WebSocket projects, my advice would be ;

    Alchemy Project : Open Source C# WebSocket Library

    Fleck Project : Open Source C# WebSocket Library

    SignalR could be nice but it needs Windows Server 8 / IIS 8 in order to provide WebSocket feature.

    On the commercial product side, especially considering the websocket feature is not available on all the browsers, i recommend PokeIn WebSocket and reverse Ajax Library. Starting from version 2.0 it has built-in WebSocket server. Details available from here

    0 讨论(0)
  • 2020-12-07 09:35

    SignalR is like Socket.IO in that it supports transport negotiation/fallback. It is a framework and not a server, so you need to host it on a server of some sort. We have hosts for ASP.NET, OWIN (e.g. Kayak) and self-host, so you can run it in your own process easily, e.g. a Windows service.

    SignalR has supported clients for browsers (JS), .NET, Windows Phone 7 and Silverlight. There are also contributed clients for things like iOS, Mono Touch, etc.

    SignalR will give you a much higher level API than raw sockets which is its big advantage, allowing you to do things like "RPC" from server to clients in a broadcast (or targeted) fashion.

    0 讨论(0)
提交回复
热议问题