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?
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With