BEIJING — The owner of an Internet cafe in southwest China was given an eight-year prison term for criticizing the ruling Communist Party in online messages and for seeking to establish an opposition party, his wife said Thursday.

The man, Cao Haibo, 27, of Kunming, the capital of Yunnan Province, was accused of “subversion of state power” for trying to set up the “China Republican Party” — an entity that existed on paper, and only for one day.

His wife, Zhang Nian, 23, said he was sentenced on Wednesday but the court only notified her on Thursday. “It is a very severe punishment and long sentence,” she said, adding that the trial was held in secret.

The sentencing comes a week before a pivotal series of meetings in Beijing during which the party will ratify a new generation of leaders.