It seems incredible that the Ryukyu Kingdom was not outright destroyed for four centuries, though at times it payed tribute to Japan and/or China. By what means of diplomacy did they accomplish this?
Talking about China -
Many people came from China during the Ming and Qing dynasties, either being sent there as official representatives or to conduct trade. The trade relationship between China and the Ryukyu Kingdom strengthened when China restricted its trade to official kingdoms and tributaries (a policy intended to prevent open piracy), as well as the military support of the Ming meant that between China and the Ryukyu Kingdom the relationship benefits were mutual.
To answer your question then - their diplomatic venture consisted of asking for Chinese help in establishing and maintaining trade routes. During the 14th and 15th centuries, most of the East China Sea was dominated by the Chinese, and their navy was proved to be the best. Because of this, the Ryukyu king requested of the Ming dynasty 36 families from the Fujian province to manage his trades.
... Chinese junks were well known to be the best cargo and passenger carriers ... Against this background, in the early fifteenth century, the king of Ryukyu asked for and received thirty-six families from Fujian province to manage his maritime affairs.
Sources:
The Eunuchs in the Ming Dynasty - Tsai, H.
Maritime sector, institutions, and sea power of premodern China - Deng, G.