Allow Smack client to receive broadcast messages

Hi,

I don´t know how to allow my Smack client to receive broadcast messages.

I´m using a PacketListener with a Message.Type.chat filter for receiving the messages from other users and work well but with this I don´t see the broadcast messages.

Thanks in advance

Can someone tell me something? I don´t find the clue.

Hi,

enable debugging like:

XMPPConnection.DEBUG_ENABLED = true;
          con = new XMPPConnection("myown.server.com");

When a broadcast is sent you should see something like this:

<message from="myown.server.com">
  <body>Elvis has left the building.</body>
</message>

So it’s a message without ***to ***and a message type normal.

Create you could create a PacketFilter that accepts these packets.

Add that Filter together with a Listener to your connection.

You might not like to get all broadcasts, so maybe it’s a good idea to limit broadcasts by sender.

Hope this helps.

c