Is SignalR a suitable substitute for jQuery Ajax (or similar)

后端 未结 1 452
梦如初夏
梦如初夏 2021-02-07 02:50

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

Thanks

相关标签:
1条回答
  • 2021-02-07 03:12

    If all you need to do is browser-initiated calls to the server triggered by user actions then you should just use jQuery 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.

    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.

    0 讨论(0)
提交回复
热议问题