SignalR是否可以替代jQuery Ajax(或类似版本) [英] Is SignalR a suitable substitute for jQuery Ajax (or similar)

查看:386
本文介绍了SignalR是否可以替代jQuery Ajax(或类似版本)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

按照标题,SignalR是否适合替代网页中使用的常规Ajax(例如jQuery Ajax)更新.

As per title, would SignalR be a suitable substitute for general Ajax (e.g. jQuery Ajax) updates used in web pages.

谢谢

推荐答案

如果您要做的只是由用户操作触发的浏览器对服务器的调用,那么您应该只使用jQuery Ajax.

If all you need to do is browser-initiated calls to the server triggered by user actions then you should just use jQuery Ajax.

仅在服务器需要根据任何用户操作异步更新客户端的情况下,使用SignalR.在传统上使用计时器和Ajax调用重复轮询服务器以查看是否有任何更改的情况下,可以使用它.

Only use SignalR where the server needs to update the client asynchronously to any user action. Use it in situations where you would traditionally have used a timer and an Ajax call to poll the server repeatedly to see if anything has changed.

在同时发生两种呼叫的情况下,您可以将SignalR用于用户操作和服务器传递的通知,但是将它们分开可能更容易/更干净.

In a situation where you have both kinds of call happening you can use SignalR for both the user actions and the server delivered notifications but it may still be easier/cleaner to keep them separate.

这篇关于SignalR是否可以替代jQuery Ajax(或类似版本)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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