0

I would like to allow a user via browser to receive updates if a database record has been changed in (near) real time without reloading the web page.

The idea is:

  • User opens url /dbrecord.php?id=12345

  • Registers for SSE (or something else) to receive updates to the record

  • Received on screen notification of what has been changed in the record without reloading the page

However this needs to be performant as there are a lot of DB Change events and a lot of potential users. Can you please let me know if the approach is good or are there better technologies / approaches to build something like this?

UPDATE: Found this - Server Side Events with PHP & MySQL But it requires a while(true) loop in the PHP script and this cannot be good to have the SQL Query in there?! Any feedback?

Thanks, fj

chtz
  • 17,329
  • 4
  • 26
  • 56
user1827421
  • 51
  • 1
  • 7
  • using a while loop is fine and querying inbetween iterations is fine (you need to query your data somehow). a better sse example can be found here: https://stackoverflow.com/a/49081040/661872 – Lawrence Cherone Mar 31 '20 at 13:07
  • Thanks, this clarifies it for me. Appreciate your support! – user1827421 Apr 01 '20 at 06:38

0 Answers0