websocket heartbeat moved to -main function