Last post Feb 18, 2014 08:35 AM by mou_inn
Feb 17, 2014 08:44 AM|mou_inn|LINK
Forum is place where lots of people ask question and same way many people give answer for the question.
i want that when some one will post question and whoever seeing that question opening that page and in the mean time if anyone give answer for that question then that answer will be broad cast to all user who is on that question page. i want to do it with
we know that signalr has hub and from there we can hit database periodically and fetch the status and inform all user about the status by broadcast but hitting db periodically may not be good approach rather when db will be updated then something will inform
my hug with some data and then hug will broadcast that data to all user who is on that question page.
my 1st concern is when db will be updated how do i know programmatically ? 2nd concern how do i call signalr hub method from out side with data fetch from db?
so please guide me how could i know when db updated without polling technique rather i want something which push updated data to signalr hub automatically when db updated?
also another important question is how to inform signalr hub from out side with data or passing parameter ? if possible discuss in details with some sample code. thanks
Feb 17, 2014 05:57 PM|abhishek.nanda|LINK
Well for the database, you can simply add that trigger logic in your code where you add the new row to the table. To see how to call hub methods from the outside the hub, see the following:
Feb 18, 2014 12:42 AM|Ruchira|LINK
my 1st concern is when db will be updated how do i know programmatically ?
You can use
SqlDependency for that.
2nd concern how do i call signalr hub method from out side with data fetch from db?
Check the Brij's blog post below
also another important question is how to inform signalr hub from out side with data or passing parameter ?
var context = GlobalHost.ConnectionManager.GetHubContext<HubClassNameHere>();
context.Clients.All.methodName(pass parameters here);
Please 'Mark as Answer' if this post helps you
Feb 18, 2014 08:35 AM|mou_inn|LINK
what is the meaning of this 2 line
i guess the above two line we need to write in global.asax in app_start?
what is GlobalHost ? is the code based on persistent connection i guess. i mostly viewer hub related code.