China and Vietnam have agreed to enhance security cooperation in their move towards a "shared future" community. During Xi Jinping's visit to Hanoi, the Communist-ruled nations signed dozens of cooperation pacts and agreed to establish more hotlines to defuse emergencies in the South China Sea. The aim was to avert the risk of a "colour revolution" promoted by hostile forces.