Broadcast an XMPP message using SMACK

Could someone please help me know if there is a way to broadcast an XMPP stanza to a group of users in the same domain using SMACK API?


Jaya Krishna

To my knowledge you have to send a message to each individually.

Other than that you could use a chat room or pubsub, but both would require the other users to effectively register in some way.

Thanks for the info rcollier. Idea is to do not let the users respond on the message we send but to consider the message as a notification. So, just wondering if there is a way to send a broadcasted notification to a group/ list of users.


Jaya Krishna

This matches with the usage of pubsub, but it will require the users to subscribe to the node.

Have you considered using the broadcast plugin? We have used it in combination with a ‘headline’ message which is sent to all@broadcast.domain.

see RFC 6121:

headline – The message provides an alert, a notification, or

other transient information to which no reply is expected (e.g.,

news headlines, sports updates, near-real-time market data, or

syndicated content). Because no reply to the message is expected,

typically a receiving client will present a message of type

“headline” in an interface that appropriately differentiates the

message from standalone messages, chat messages, and groupchat

messages (e.g., by not providing the recipient with the ability to

reply). If the ‘to’ address is the bare JID, the receiving server

SHOULD deliver the message to all of the recipient’s available

resources with non-negative presence priority and MUST deliver the

message to at least one of those resources; if the ‘to’ address is

a full JID and there is a matching resource, the server MUST

deliver the message to that resource; otherwise the server MUST

either silently ignore the message or return an error (see

Section 8).