1
I would like to know how the process of capturing updates of messages and posts (back-end) is done automatically by the font-end (Like the one performed by facebook). Anyone have any idea?
This is done through threads in js?
1
I would like to know how the process of capturing updates of messages and posts (back-end) is done automatically by the font-end (Like the one performed by facebook). Anyone have any idea?
This is done through threads in js?
4
There are three broad outlines, namely:
a. a recursive timeout looking for new information. when this information exists, it is displayed. this approach is more common because it is simpler to implement, but it is not recommended because it is not scalable, that is, in an environment with thousands of users will be made thousands of requests * N seconds, mostly unnecessary, increasing spending on bandwidth and infrastructure.
b. ajax Comet. is a technique that leaves an http connection open so that the application can send information to the browser even after some time (generally http connections last only a few seconds, ajax Comet consists of circumventing this http feature). search for ajax Comet associated with the language you program in a search engine you will find several tutorials.
c. websocket. is only available in modern browsers. is a new protocol and it allows communication back and forth with the browser (it is the approach that we will all use in the near future, today it has the problem of not working in the old browsers).
note 1: facebook uses a merge between a and b. basically uses Comet but when the activity decreases it closes the connection and switches to a recursive timeout that also dies after a while. after long downtime it only updates when the user interacts with the page.
note 2: each of these paths has several techniques with advantages and disadvantages. take a look here on ajax Comet, it is well clarified:
Browser other questions tagged javascript thread
You are not signed in. Login or sign up in order to post.