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



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 layer.

I have built a Node.JS + Socket.IO app which connects to my TCP server and then pushes communication to the web application and all works fine.

I have just read about SignalR as an alternative to keep it in the .Net stack.

However I have also found that I could write a C# Websocket Server, a basic demo here

I assume that this basic server is what SignalR is but obviously with a lot more functionality in it?

What I'm trying to decide is do I just append my current TCP application with a Websocket server or do I go down a separate SignalR or Node.js route? Out of interest how does a SignalR application run, is it as a Windows service, console app or IIS service?

share | edit | flag
 
1
 
For info, you might try SuperWebSocket too. For now, I just wrote a WebSocket server directly. There's only 2 key protocols in play (the rest are virtually identical variants), so it isn't massive. I'm partly waiting for .net 4.5 / win8, which includes WebSocket server support OOTB. –  Marc Gravell  Mar 2 '12 at 17:26
 
 
@MarcGravell Thanks. Here is a post showing .Net 4.5 Websocket server marcinbudny.blogspot.com/2011/10/… I'm not sure how the server runs though. –  Jon  Mar 2 '12 at 18:32
1
 
Don't forget that socket.io does a lot more than just websockets, it also does fallback to long-polling, etc. –  mtsr Mar 5 '12 at 16:24
 
 
@mtsr I believe SignalR has fallback as well –  Jon  Mar 5 '12 at 20:28
 
 
Sure, but when writing a basic C# websocket server, you would have to implement it all yourself. –  mtsr  Mar 6 '12 at 14:50
show 2 more comments

2 Answers

up vote 11 down vote accepted

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.

share | edit | flag
   

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

share | edit | flag

Source:

http://stackoverflow.com/questions/9537641/node-js-socket-io-vs-signalr-vs-c-sharp-websocket-server

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值