Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to make notifications & live online by mvc

how to make notifications & live online by mvc? i'm use $.ajax() by jquery. example:

window.setInterval(function () {
   $.ajax({
       url: "",
       type: "GET",
       data: {},
       success: function (data) {

       }
   })
},1000);

Do you the process of sending requests to a server by $. Ajax frequent by Timer affects on the server or database?

like image 982
Yehia Elhawary Avatar asked Dec 14 '25 15:12

Yehia Elhawary


1 Answers

I think is better that use SignalR.

ASP.NET SignalR is a new library for ASP.NET developers that makes it incredibly simple to add real-time web functionality to your applications. What is "real-time web" functionality? It's the ability to have your server-side code push content to the connected clients as it happens, in real-time.

You may have heard of WebSockets, a new HTML5 API that enables bi-directional communication between the browser and server. SignalR will use WebSockets under the covers when it's available, and gracefully fallback to other techniques and technologies when it isn't, while your application code stays the same.

SignalR also provides a very simple, high-level API for doing server to client RPC (call JavaScript functions in your clients' browsers from server-side .NET code) in your ASP.NET application, as well as adding useful hooks for connection management, e.g. connect/disconnect events, grouping connections, authorization.


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!