Pushing notifications continuously w/ SignalR and ASP.NET MVC (realtime)

732 views Asked by At

I am trying to figure out how I can setup continuous realtime notifications to a page using SignalR.

All of the samples/tutorials I find with SignalR are with a textbox and a send button. When text is sent, it is displayed to all clients. Instead of this I need to continuously post notifications where NotificationStartDateTime = DateTime.Now().

Would my GetNotifications() function that calls the repository go in my NotificationsHub class? Additionally, how can I continuously call it and receive the results on the client.

Here is my current client code:

        // Declare a proxy to reference the hub. 
        var hub = $.connection.notificationsHub;
        // Create a function that the hub can call to broadcast notifications.
        hub.client.broadcastNotifications= function (notifications) {
            alert(reminders[0].title);
        };
        // Start the connection.
        $.connection.hub.start(function () {
            // Call the GetNotifications method on the hub. 
            hub.server.getNotifications();
        });
0

There are 0 answers