Chat only for selected groups

I have installed the chat and chat application. I have several users and 3 groups. I want users of the same groups to have contact with each other and not the rest. Is it possible for them to see only people in the same group. I want to use it for distance learning. And all students cannot see names other than their own