By 2008, the number of internet users in China had grown a hundredfold since Geng founded Danlan. To meet rapidly growing demand, he recruited five other team members, running the website out of a rented apartment and working through the night. Eventually, he expanded to Beijing, keeping up this double life — shuttling between roles as straight Qinhuangdao cop, happily married and respected by his colleagues, and gay Beijing entrepreneur — until 2012. A friend of Geng’s asked if he could shoot a documentary about Danlan for Sohu, a Chinese social media site. Geng agreed, assuming the video would have a relatively small audience. It didn’t. Shortly after its release, Geng received a call from his police bureau, demanding he return to his post. His bosses gave him an ultimatum: Shut down the website or quit his job and leave. He handed in his resignation that day, along with the uniform that he had worn since he was 16. He was disgraced — spurned by his colleagues, disapproved of by his parents — and his marriage dissolved. But he had finally come out.

Private enterprises in China must navigate government officialdom without being directly confrontational, operating by a set of rules that are as opaque as they are capriciously applied. Crucial to Blued’s success was its ability to align its agenda with the interests of authority. When Geng arrived in Beijing, he saw that government interventions were failing in China’s growing H.I.V. epidemic. (An estimated 780,000 Chinese would contract H.I.V. by the end of 2011, with homosexual transmission accounting for almost a fifth of infections.) Geng contacted the Chinese Center for Disease Control and Prevention to offer Danlan’s services in public-health outreach, securing the company’s first government partnership in 2009.

Today Blued runs H.I.V.-testing offices with the C.D.C. in Beijing and an online databank that connects users with other testing centers nationwide. This alliance with the government gave the company legitimacy in the eyes of the public and prospective investors. In November 2012, the C.D.C. invited Danlan to take part in a conference on World AIDS Day led by a high-ranking official, Li Keqiang, now second in command to President Xi Jinping. “Greetings, Premier, I run a gay website,” Geng Le said to Li as he shook his hand. The handshake — captured as a photograph, shared widely in the media and later hung at the entrance of Blue City headquarters — changed the company’s fate. It was the party’s stamp of approval, and that seemed to lay the foundations for the company’s rapid growth.

Danlan introduced the Blued app in 2012, a few years before the government introduced a nationwide policy to boost its tech economy. The company, once kept alive by 50-to-500-yuan donations, received its first angel investment of roughly $480,000 in 2013. It then raised a Series A round investment of $1.6 million led by the venture-capital firm Crystal Stream and in 2014 raised an additional $30 million from another venture-capital firm, DCM. “We knew that social networking sites were going to be verticalized, and there were going to be niches,” David Chao, a DCM founder and general partner, says. “In China, even niches would be massive.” In the last few years, having monopolized the gay-dating app market in China, Blued has expanded to Mexico, Brazil and India. Bloomberg News has cited insiders’ predictions that should the company go public, which in 2019 it was reported to be considering, it could be valued at as much as $1 billion.

There is a saying in China that “serving the renmin” (the people) has taken a back seat to “serving the renminbi” (the yuan). Geng’s business model is apparently founded on the belief that to serve the renminbi is to serve the people. Proving gay China’s worth in the marketplace first, the argument goes, will shift public perception and pave the way for greater acceptance and freedoms. But according to Wang Shuaishuai, a lecturer at the University of Amsterdam researching digital gay-dating communities in China, this strategy might prove limited. Although social networking apps like Blued have allowed communities to form, they are closed, not public forums where Chinese people can build movements for their political rights. “The problem with being gay in China is that as long as you keep your sexual orientation private, you are fine,” Wang says. “But you cannot receive public respect and recognition.” If there were an L.G.B.T.Q. website whose major purpose was to discuss L.G.B.T.Q. activism, it would be gone within a week, according to Dan Zhou, an openly gay Chinese lawyer who specializes in gay rights. “Every day, somebody could shut down your website without prior notice,” Zhou says.

Blued has a content-moderation team that works around the clock, making sure all content is by the book. “On the Chinese app, the rules are very simple. If you show a bit of skin, you’re gone,” says Charles Fournier, a past product manager for Blued. The company’s censorship guidelines, updated constantly, recently banned images depicting shorts cropped above the knees.

Duan Shuai came out to his parents two years ago, at 30. It was Chinese New Year, and his mother was asking, once again, when he would bring a wife home. When he told her the truth, she cried, asking him to leave and never come back. He felt both sad and free — devastated to have disappointed his family but relieved to have finally spoken the words. “For many Chinese, coming out is long and drawn out,” Duan says. “Most people don’t just stride out of the closet like in American movies and announce that they are gay in this sudden, dramatic way. They’ll often agonize over it for years, gather a lot of information and place it by their parents’ bedside table, hoping that one day they’ll begin to understand.”