Group Chat with the XMPP Component


The XMPP (Jabber) component supports XEP/JEP extensions through the SendCommand method, allowing you to implement multi-user group chat functionality. To participate in a group chat, a client must join a room, send messages, and leave the room when finished.

Join a room

xmpp.SendCommand("<presence to=\"chatroom@conference.server/username\">\n<priority>0</priority>\n</presence>");

Send a message to the room

xmpp.MessageText = "Hello room!";
xmpp.MessageType = XmppMessageTypes.mtGroupChat;
xmpp.SendMessage("chatroom@conference.server");

Leave the room

xmpp.SendCommand("<presence to=\"chatroom@conference.server/username\" type=\"unavailable\"/>");

This approach enables joining, communicating within, and exiting XMPP multi-user chat rooms programmatically.

We appreciate your feedback. If you have any questions, comments, or suggestions about this article please contact our support team at support@nsoftware.com.