added heartbeat to the server-sent backend

when no messages are sent, the server cannot detect when a user is
disconnects, when running behind a reverse proxy.
So we send a regular heartbeat message, if no other messages are sent.