receive events from server, reply heartbeat