signalR VS HTML5的WebSockets的asp.net MVC聊天应用程序 [英] signalR vs html5 websockets for asp.net MVC chat application

查看:620
本文介绍了signalR VS HTML5的WebSockets的asp.net MVC聊天应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在巨大的进退两难,使用HTML5 WebSockets的或signalR聊了一会,我们将融入我们的asp.net MVC3应用

我的困境结果
1.为什么要使用 signalR 如果它实现longpolling?结果
2.Isnt longpolling不好?结果
3.websockets和longpolling完全不同?结果
4. 仅IIS8支持WebSockets的?结果
5.可我使用聊天数据保存到SQL数据库的Html5的WebSockets?结果
6.Isnt有一种解决方法,使上的WebSockets和IIS7以上版本的工作(我将只使用Chrome浏览器)结果
感谢您与我的轴承


解决方案

  1. 为什么要使用signalR如果实现longpolling?

    答:让旧浏览器的支持,或有过度抽象的数据传输实现细节的较高水平。如果您肯定会使用Chrome的版本具有的WebSockets支持 - 使用WebSockets(很好的解释这里


  2. 心不是longpolling不好?

    答:实际上它是不是最好的(见上面的链接),但有总比没有对旧的浏览器更好


  3. 的WebSockets和longpolling完全不同的?

    答案:它们是完全不同的(再次见回答以上),但有不便共同点为它们(它们都需要一个连接)


  4. 只有IIS8支持WebSockets的?

    答:如果你想使用纯.NET框架 - 是的,只有IIS 8和.NET 4.5。但是你可以使用其他服务器的WebSockets(见下面的解决方法)。


  5. 我可以使用聊天数据保存到SQL数据库的Html5的WebSockets?

    答:WebSockets的仅仅是一个协议发送的数据的,所以从字面上使用它的则不能,除了传输数据执行任何操作。然而,你可以,比方说,有一个将被发送到服务器,将意味着一个令牌全部保存previous数据DB。或者你可以根据不同类型的消息像inplemented在 socket.io为node.js的有更加复杂的场景。


  6. 心不是有一种解决方法,使上的WebSockets和IIS7以上版本的工作(我将使用Chrome浏览器只)

    答案 - 是的,就是不使用IIS,但另一个服务器的WebSockets执行(如弗莱克 - 有老好看的支持浏览器支持webseckets)并运行它旁边IIS作为例如一个单独的进程。


I am in great dilemma as to use html5 websockets or signalR for a chat we are going to integrate into our asp.net mvc3 application

My dilemmas
1.Why to use signalR if it implements longpolling?
2.Isnt longpolling bad?
3.websockets and longpolling completely different?
4.Only IIS8 supports websockets?
5.Can i save the chat data into SQL database using Html5 websockets?
6.Isnt there a workaround to make websockets work on IIS7 and higher versions(i will be using chrome browser only)
Thanks for bearing with me

解决方案

  1. Why to use signalR if it implements longpolling?

    Answer: to enable support for old browsers or to have a higher level of abstraction over data transfer implementation details. If you definitely will use the version of chrome that has a websockets support - use websockets (good explanation here).

  2. Isnt longpolling bad?

    Answer: actually it is not the best (see link above), but better than nothing for old browsers.

  3. websockets and longpolling completely different?

    Answer: they are quite different (again, see answer above), but there is smth in common for them (they both require a connection).

  4. Only IIS8 supports websockets?

    Answer: if you want to use pure .NET framework - yes, only IIS 8, and .NET 4.5. But you can use another websockets server (see workaround below).

  5. Can i save the chat data into SQL database using Html5 websockets?

    Answer: websockets is only a protocol to send data, so literally using it you cannot perform any action except of transferring data. However you could, say, have a token that will be send to server and will mean "save all previous data to DB". Or you could have more complex scenarios based on different kind of messages like inplemented in socket.io for node.js.

  6. Isnt there a workaround to make websockets work on IIS7 and higher versions(i will be using chrome browser only)

    Answer - yes, just do not use IIS, but another websockets server implementation (e.g. Fleck - has nice support for "old" browsers supporting webseckets) and run it alongside IIS as a separate process for example.

这篇关于signalR VS HTML5的WebSockets的asp.net MVC聊天应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆