Send a real EventSource event for heartbeat

The EventSource connection can get stuck (in TCP half-open state*) and there's no way
for the client to detect that. This commit changes the way heartbeat is sent, instead of
sending a newline character, it sends an empty event of type heartbeat:

    event: heartbeat
    data:

This event doesn't have an id: field, so the client will retain its latest Last-Event-ID state.

This doesn't change the expectations of clients that used EventSource till now, because they
subscribe to the 'message' event type. To get the 'heartbeat' events a client will need to
explicitelly subscribe to it:

    source.addEventListener('heartbeat', function () { // cancel a timer that would otherwise reconnect the source });

* this can happen when you suspend your laptop, on flaky internet conection, ADSL reconnect,
bad wifi signals, bad routers etc. Pretty often in a typical internet usage nowdays.