I am using SqlDependecy with signalR to push notifications to client browser when there is some database changes, I followed this and this post an
In shared hosting because they restrict some features, so i was unable to use SqlDependency, but here is my solution to Play notifications without SqlDependency in asp mvc
If you are new signalR, then first try this post to create simple chat web application.
My requirement was to play notifications when new sales happens in shops
1. Create SignalR Server Hub
SignalR server hub class that sends messages to all clients browser.
[HubName("PascalCaseNewSalesHub")]
public class NewSalesHub : Hub
{
public void Send(string shopid)
{
// Call the alertNewSalesToPage method to update clients.
Clients.All.alertNewSalesToPage(shopid);
}
}
2. Javascript Send Method in PlaceOrder View
When a customer places new order for this shop then the following javascript code Calls the Send method on the server hub to update clients.
Used Howler.js Plugin to play notification , check this post.
Hope helps someone.