Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I've seen signalR vs html5 websockets for asp.net MVC chat application but it doesn't 100% answer my question as it's based around HTML5 WebSockets, which Microsoft may have extended upon in .NET 4.5 with their WebSocket object.

I'm wondering if the WebSocket feature does actually do the same as SignalR and fall back to long polling when WebSockets aren't available? Surely Microsoft would implement the same technology as SignalR in their approach to this technology?

Edit:

For anyone else wondering about this, I found this comment the most helpful to understand the scenario and why I'll be using SignalR:

Well, they are not really. Up until now IIS and ASP.NET didn't have anything built in that supported WebSockets so SignalR project had to build it themselves. Now that Microsoft is providing the plumbing SignalR could easily switch to using Microsoft's implementation, either in addition to or instead of their own. SignalR is an abstraction over implementation details, WebScockets class is the implementation detail

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
539 views
Welcome To Ask or Share your Answers For Others

1 Answer

I think SignalR is the way to go, and is going to be part of .NET itself anyway (and likely extend/merge/replace web-sockets support). It uses web sockets when it's supported, and consistent client polling hack when it's not, so, it's the way to go.

Update:

Since this answer is still getting upvoted, it's worth mentioning that SignalR is now officially part of ASP.NET.

Check http://asp.net/signalr

Update: .NET Core

SignalR is also being added to .NET Core as @yazanpro noted in comments.

It's available in .NET Core 2.1, and has official documentation as well.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...