.NET 4.5 WebSockets vs SignalR

后端 未结 3 1233
北荒
北荒 2020-12-08 03:49

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 h

3条回答
  •  难免孤独
    2020-12-08 04:43

    1. 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?

      WebSockets is a new protocol independent of other communication techniques. From the RFC

      The goal of this technology is to provide a mechanism for browser-based applications that need two-way communication with servers that does not rely on opening multiple HTTP connections (e.g., using XMLHttpRequest or s and long polling).

    2. Surely Microsoft would implement the same technology as SignalR in their approach to this technology?

      Not if they want to conform to the specification they won't. There's certainly nothing stopping Microsoft from developing a higher level API similar to SignalR that would abstract away communication detail and offer graceful fallback. However that hypothetical API would probably build on top of WebSocket class as opposed to replacing it.

提交回复
热议问题