It really depends on you, them, and the situation. That was clear as mud, huh? Early in sobriety being around any drinking bothered me. Now as time has gone on, my tolerance has changed. Where I used to feel anxious and jealous, I now have no feeling at all. However, that being said, I wouldn't go hang out at a bar. I don't mind going out for dinner or whatnot with drinkers. But if the whole purpose is getting buzzed or drunk, then I'm out.
As for being lonely, have you considered any f2f support groups? I enjoy being around people like myself who have found other entertaining things to do in life.