For years the government has been working to ensure that people’s real names are linked to their online activities. Beijing has also long restricted many types of online content, from pornography to political discussion.