I've often felt like the internet is a gathering place for people who are stressed out by the real world and seek a refuge. It's a symptom. When the real world causes a certain level of anxiety, this can lead to depression.
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.