0

so I am looking for making a web app that gets data from the server periodically.

my initial thought was issuing an ajax call inside a loop that asks the server if there is news every 2sec so when there are new things to show the server will send data otherwise will just reply with an empty payload

I am wondering if there is a better approach so the server won't waste sources replying to all those unnecessary ajax calls but instead it will only send data to the targeted client

Anas Elb
  • 1
  • 1

1 Answers1

-1

you can use

<p:poll>

tag if you are working with Primefaces or use WebSockets

Tadas B.
  • 176
  • 8