Perhaps some British East India Company staff stationed in Canton, as well some diplomats in major cities and various missionaries scattered across the country? How did the various kinds of expats live?
Yes there were foreign embassies in China as well as traders and merchants. Some richer and more important ones built homes in China. They were limited to the single port in Canton at that time and the rank and file sailors / traders were limited to staying in factories. I'd imagine most of the rank and file did not bring their family nor were they allowed to stay permanently until later. There were some missionaries serving in the imperial court though.