My path to doing this was to encourage interest based communication, in a way that would allow them to take it offline. How? Well to make it interest + geography, i.e. horology nerds in Cumbria, cyclists in London, petrol heads in Cornwall, audiophiles in Suffolk.
By binding together an interest, and a geography, it naturally encourages trade, showing off, having a beer... and coming together. But not in a way that ever was to "cure loneliness" (which few people admit to feeling, and frankly most people find lonely people unattractive people from the perspective of wishing to hang out with someone like that).
By providing a space to share a passion, the forums brought people together.
I had to make our own software to achieve this, i.e. a forum with events built-in by default, etc. But it worked.
Except I couldn't get it funded beyond the crowd-funded angel round :shrug . But still, 250k monthly users, hundreds of marriages, tens of thousands of friendships, and still people meeting weekly for beer and chatting with others.
And like all love, when the lust is gone what remains is something special... these forums are evolving now, from the original interests, into just a group of friends for life.
If I were lonely today, I would say... identify a hobby or interest you could get into, start looking for entry things to dive in, and then look for groups on MeetUp, or forums online, that will help you find other people.