In the usual case (meaning you're using only one editor and not several, e.g. because you're answering a question while also editing it and another answer etc.) -- the heartbeat happens every 45 seconds.
It sends the following:
- Whether you're writing a question, an answer, or are editing a post
- When answering, it sends the Id of the question you're answering. When editing, it sends the Id of the post that's being edited.
- When answering, it sends information about what other answers the client (i.e. your browser) already knows about (see below)
- If you're asking or answering, and you have changed something since the previous heartbeat, it sends the full text of the post (and, if applicable, title and tags)
The server saves the draft, and returns the following to the client:
- When asking, it returns a list of "similar questions" that's shown in the sidebar
- When answering, it checks whether the question has been deleted, locked, or closed in the meantime (you have certainly seen the "this post has been closed; no more answers will be accepted" message before – this is where it comes from)
- When answering, it checks whether there are answers that the client doesn't know about yet (see above), so you get the "2 new answers have been posted" message
- When editing, it checks whether the post has been locked or deleted, or has been edited in the meantime ("This post has been edited 1 time since you began").
Random trivia: The heartbeat is controlled by an object called