How to detect connection loss on serverside? The documentation says there is a heartbeat but I have no idea how to get notified.