Robbey Watt gives candy to Morgan and Merrick Thomas as they trick-or-treat at his house in Bowling Green, Ky., in 2010. (Joe Imel/Daily News via AP)
Anne Bramley is an independent scholar and the author of Eat Feed Autumn Winter. Her work has appeared at NPR and Saveur.

A stranger knocks on your door. What is it this time? Politics, religion, magazines? Rarely do we meet the surprise intrusion with enthusiasm. Especially if the knock comes in the darkness of night.

More and more, we seem to avoid face-to-face time, in our communities and on our doorsteps. The more we retreat into social media, the less social we become. But there’s one night a year when we still revel in the up-close and personal offline. Total strangers haunt our doorsteps in frightening mobs or as freakish ax-wielding loners. Some ask for a handout without any costume at all. And yet we fling open the door to welcome them. With fistfuls of food.

Although we may not traditionally think of Halloween — with its ghouls and ghosts and toilet paper in the trees — as a night of hospitality, today it functions as one of the few times we really give to those we’ve never met and connect with people outside our network. We should to do everything we can to celebrate it.

Of course, Halloween has its critics. It’s deeply commercial: Americans spent $7.4 billion on it last year, more than any other holiday except Christmas. Adults have co-opted it as their own, as evidenced by the proliferation of the “sexy” witch/devil/cat/pumpkin costumes that have turned the holiday into foreplay. And then there are the perennial warnings that it’s a pagan holiday, or, quite wrongly, satanic. But as far back as the Puritans, the religious right has been bad mouthing Halloween — not for its lack of churchiness but for having too much Catholic ritual about it: All Saints’ Day (Nov. 1) and All Souls’ Day (Nov.  2) were two of the most important dates in the medieval Catholic calendar, and the hallowed eve of Oct. 31 marked the gateway to the two-day celebrations of the dead.

And the history of trick-or-treating isn’t exactly sweet. Candy appeared pretty late, explains Lisa Morton, author of “The Halloween Encyclopedia” and “Trick or Treat: A History of Halloween,” and it was mainly introduced to bribe unruly children into more civilized celebrations. Halloween as a night to terrorize neighbors “had gotten really out of control in the late ’20s and early ’30s,” says Morton. As the Great Depression took hold, Halloween mischief became more destructive. Street lamps were vandalized, car windows smashed. And that’s when “a lot of the cities came up with these very institutionalized plans to control pranking by buying the kids off with parties.” And sugar. Then after World War II, candy companies spotted an opportunity, and trick-or-treating took off.

But despite trick-or-treating’s function as social control and cash cow, in an age of virtual lives, it’s now a good reason to take back the night in the spirit of human contact. Centuries ago, that community-focused spirit of autumn hospitality was once expressed in customs like “souling,” or begging door-to-door on All Souls’ Day for soul cakes in exchange for offering prayers for those in purgatory. Today, we can keep such hallowed traditions alive by hewing not to their letter but their spirit. Halloween should be about taking a chance to open our doors to strangers, to connect with people face-to-face, or at least mask-to-mask, to open up rather than turn off the light and close the door. For some of us, it might be the only night of the year when we see inside of our neighbors’ homes, and let them glimpse ours.

A few years ago, when I wrote a cookbook on entertaining in autumn and winter, I wanted to give readers a reason to get out in the cold to meet and eat with each other rather than retreat into the indoor life we create on our screens. And that’s what Halloween does better than any other holiday. It brings hospitality into the streets.

So when I host a Halloween party, I always have someone perform the medieval poem “Lyke Wake Dirge.” With lines that pace like pallbearers loaded with a coffin, it is one of the most haunting poems about that sliver of space between life and death that is Halloween night. But the most haunting thing about it? The dire warning to be hospitable. In each stanza, the funereal dirge reminds listeners to give freely in this life in order to receive peace in the next. If you have failed to offer “meat and drink,” the speaker threatens, may the fires of hell burn you to bare bone.

But if you can’t do it for the sake of your immortal soul, do it for society. Prepare the candy feast. Throw your door wide. And welcome all to your home, whether adorable preschool princess or the teenager in a last-minute “costume” of jeans and T-shirt. Don’t speculate about what the holiday once was. Don’t complain about what it has become. Just keep it going. It may be our best defense against social isolation.