answer:I am a software engineer; I do not know how Facebook actually implements this but here’s how it could be done: Say you’re at your computer looking at a Facebook post. When you start to type in the comment box, your browser knows that the contents of the box have changed. Usually, this information does not need to be communicated to Facebook’s servers in order to “publish” this comment until you hit the “post” button. However, to implement the feature you described, you could bind an “action listener” to the text box. This is basically a function that gets triggered any time the contents of the box change. The action listener could then send an ajax call up to the server. Ajax calls are asynchronous (that’s what the first A stands for), meaning that the call can happen “in the background” while you’re still doing whatever you’re doing, so it doesn’t interrupt your typing. The ajax request can then go talk to the server and give an indication that the contents of the text box are changing. So, we know this probably means someone is typing. In order to optimize this so that the server doesn’t get bogged down with billions of requests every second, I would guess that the action listener filters out most changes before talking to the server. That is, we don’t care if the contents of the text box just changed from “Hi” into “Hi Judy,” but we do care if the text box just went from empty to non-empty, or vice versa, as these are the indicators that someone has either just started or just stopped typing.