Link to home
Start Free TrialLog in
Avatar of websss
websssFlag for Kenya

asked on

SignalR - getting new data from sql DB

Im looking at SignalR, however i'm a little confused about how it will update based on new data

I have a sql server 2014 enterprise table called tblAssets
On this table is a column called LatestRecordId

This contains the latest ID from a table called tblAssetLogs

Currently, every 30 seconds I use long polling to get the latest asset log data.

What i want to do:
1. every time tblAssets.LatestRecordId is changed, then push the new data to the client

Does anyone know if this is possible? and how i would achieve this?

I'm using .net framework 4.5 and iis7 on windows 2008 r2
Avatar of Nakul Vachhrajani
Nakul Vachhrajani
Flag of India image

Based on your requirement, it seems that you need transactional replication between the Assets database (article to replicate would be based on the data to be exchanged with the client) and the client database.
Avatar of websss

ASKER

I'm not sure what that means
But in a nutshell
When an ASSET sends new data to the server, we insert it into the LOG table, and then use the newly inserted records ID to update the ASSETS table (tblAssets.LatestRecordId)

When this ID changes, it needs to push to the client as the data needs to be refreshed on their browser

how do we do that?
Oh, refreshed on the browser application. I thought it was to be sent over to another database/database system. Sorry.

You can have a ROWVERSION column on your dbo.tblAssets tables. This data should be stored in your session. What you need is a process on the client side that regularly polls the database for changes by checking to see if the ROWVERSION has changed (it will automatically change when you update the data in the table), and if a change is detected, refresh the UI.

Database systems, unlike front-end applications do not have the ability to "fire" a message - they are data storage and processing areas and once processed, the requesting application has to pick up the data (like a kitchen, for example - an order comes in, it is serviced and then the banquet staff must periodically check and pick it up if the meal is ready).
Avatar of websss

ASKER

hmmm
this is long polling, and i do this already
Kinda outdated now
ASKER CERTIFIED SOLUTION
Avatar of Nakul Vachhrajani
Nakul Vachhrajani
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial