I am building a financial website that allows user...
# help
l
I am building a financial website that allows users to view realtime quotes of assets; Such as stocks. I am going to be updating around 1,000 rows every 15minutes. I need to add a realtime subscription so they get the most recent quotes as they are updated.... my only problem is; That would cause them to be sent all 1,000 rows when maybe they only need 5 specific quotes. Is there any way I can filter the subscription for specific rows by id?
n
Hello @liljamesjohn! This thread has been automatically created from your message in #843999948717555735 a few seconds ago. We have already mentioned the @User so that they can see your message and help you as soon as possible! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ``...`` menu) and select "Leave Thread" to unsubscribe from future updates. Want to change the title? Use the ``/title`` command! We have solved your problem? Click the button below to archive it.
g
You can only do one .eq filter per subscription right now. It is unclear if you mean about 1000 rows will be updated in 15minutes, or you do an update every 15 minutes to 1000 rows. If you are only worried about 15 minute time frame, you are probably better off polling. You would only need to poll when the screen loads and until the screen goes away, potentially.
l
I am building a stock market platform. I have a python script that generates real time quotes/ indicators for 1000 rows and then either inserts them or upsets them. Ideally I will get it down to every 5mins. But I have no way of telling which stocks the user has on screen (it can be 10+), I’m wanting it to update as quick as it’s inserted. If I polled for the data, couldn’t that impact UI performance (next.js). But using real-time means the user will be sent 1000+ rows every 5mins… which would be bad for the client and I assume worse for the server/ db if I have a large user count
g
Yes those are the current tradeoffs with just the single .eq filter. Realtime itself is sending/receiving small packets every 30 seconds for every connection also (just not hitting the database). I assume the download part counts against data costs. So polling every 5 minutes might be a wash, but certainly extra database calls. You normally should shut the realtime connection off when the tab loses focus (chrome/edge and mobile) as it will timeout/error anyway. Then you have to reload all data (or have a timestamp filter on what changed) before doing realtime process again when the app/page comes back in focus or from power saving mode.