Subhash Sasidharakurup
Subhash Sasidharakurup

Reputation: 368

Difference between smack packet listener and message listener

Hi I am creating an android app as a XMPP client to an ejabbered server.

But I am really confused because I saw I can send messages as apacket or messages also I can receive messages using PacketListener and MessageListener.

Whats the difference between PacketListener and MessageListener and which is the good way to receive messages? Using packet listener or message listener?

Upvotes: 6

Views: 1427

Answers (2)

Fallak Asad
Fallak Asad

Reputation: 368

MessageListener only listen for the packets related to messages while PacketListener listen for the all kinds of packets that may include message related packets, subscription related packets, invitation related packets, it may listen for the all xml packets send by the server if no filter is applied. You may also add filter to filter specific packets. it is also used for process custom packets and writing custom XMPP extensions

Upvotes: 5

vitalyster
vitalyster

Reputation: 5266

MessageListener is a high-level interface just to deal with messages, PacketListener is more complex "tool" to match and process custom packets and writing custom XMPP extensions. If MessageListener suitable for your needs - just use them.

Upvotes: 1

Related Questions