#How to Load Data in Real-Time from Backend Without Refreshing?

3 messages · Page 1 of 1 (latest)

rare haven
#

Hey everyone!

I'm working on an Angular project, and currently, I'm fetching data from the backend using ngOnInit(). The issue I'm facing is with my chat feature:

  • On the home page, I create a new chat.
  • When I navigate to the chat page, the newly created chat does not appear immediately because it's not loaded in yet.
  • The only way to see it is to refresh the page, which triggers ngOnInit() again and fetches the latest data.

I’m looking for a way to fetch data in real-time so that when a new chat is created, it instantly updates the UI without requiring a page refresh. Would WebSockets, RxJS polling, or another approach be a good solution for this?

Any advice would be greatly appreciated! Thanks in advance!

cyan wing
#

<@&748787594543759390> ^ NotSure