In old China, once a woman married, she often left behind her family and friends. Hence this tradition of of an extended sleepover with her closest female friends. Called "retreating to the cockloft," this took place in a separate part of the house such as the cock loft, another name for a small attic.
The bride’s besties showed how much they cared by singing songs mourning her departure and cursing the matchmaker, the groom’s parents, and even the bride’s.