Is it possible to apply push technology?

Asked

Viewed 356 times

5

I have a system, in which it displays database files, in list form.

I do the query in the database every 5 seconds to see if there are new files, and if you have it is shown to the user using AJAX.

What’s it for? To avoid updating the page all the time, to see if you have any new files.

Only they advised me not to do this, because if you have 100 users online, every 5 seconds 100 queries are made on the server.

They told me about push technology, and this is where my doubt lies, how to implement this technology?

  • 3

    http://answall.com/questions/19345/howto work com-websockets, http://answall.com/questions/9067/%C3%89-poss%C3%Advel-fazer-comunica%C3%A7%C3%A3o-client-server-real-time-via-http

  • 5

    If you have a controlled environment, you can use Node.js + Socket.IO to do this service much more efficiently.

  • Search for: Websockets and Comet Programming

2 answers

1

When you need to keep the client synchronized with the server making AJAX requests may not be the best option, the best option we have is the use of sockets where unlike the common request from client to server the server can also "call" the client to say that something happened.

You can make sockets with PHP that in the case would be Websockets, unfortunately I do not know any quality content in Portuguese that address this but if you want to access this project of github that shows a Websockets project with PHP https://github.com/ghedipunk/PHP-Websockets, the detail is that for this you will need access to the linux server terminal (SSH)

-1

This image represents the difference well:

inserir a descrição da imagem aqui

  • 1

    Kelvin can comment on this image to make the answer more complete?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.