That's the work we do on boundaries, NLS... knowing what is the appropriate way to respond in specific situations. When to gently point out a boundary... and a violation... and ask that it not be repeated -- and when to, in no uncertain terms use anger to indicate that the violation was uncalled for; won't be tolerated; and woe to the idiot who crosses that line again!! Even when to physically defend ourselves...
And there just aren't any guidelines or rules - each situation calls for judgement, experience, and a knowledge of your own personal level of comfort with the person in question. Exactly what and where your boundaries are. This varies from person to person, I think. When I started doing exactly the same work you're doing I was like a gawky teenager who said/did lots of inappropriate things, with a high level of anger and rage... I was easily "triggered" into the full emotion of what I call "old" anger - the long-term, bottled up anger from my childhood. And I really need to express it. Consequently, I felt embarrassed or even guilty for letting that intense old crap fly, in situations that really didn't call for it. And consequently, I did a lot of apologizing!
I think that this stage is inevitable - it's a developmental stage, emotionally - that usually happens way younger than we are now. But the family dynamics and individually abusive situations we've lived through prevented that from happening. Just like it's more difficult to learn a foreign language when you're older - and your brain isn't as wide open and receiving as in childhood growth spurts - it's also awkward to learn about boundaries when you're older.
IT'S OK IF YOU MAKE MISTAKES!! When you're learning something, you are going to make mistakes - they're just mistakes and nothing "bad" happens. When it's a boundary mistake, many times, a sincere apology is all the other person requires. In a cyber situation like you described - if you don't have an ongoing, online relationship and his comment was just lobbed from his perspective - well, then... you WERE angry and you expressed it. Maybe it was a little over the top... it's completely up to YOU, to decide if the anger was called for - if the expression was appropriate... and other people's opinions about it, are their opinions: and are subjective and relevant to their own comfort-levels with boundaries and anger.
Lots of people think all anger - in any form - is "bad". I completely disagree. It's as important and necessary as fear, in protecting ourselves... and I think anger is pivotal in healing, for many of us.