If you imagine how people you might label as happy and social IRL use the net, they're online either to work or reinforce their real life connections. For them, the net is a tool rather than a destination. This article is a broad overview, but it seems to make sense in general.
I highly recommend reading Learned Optimism. It's not just some empty feel good self-help book, it has scientific rigor and explanations of the causes of much of depression.