I created a chat and used chat.addMessageListener to add a PacketListener that I thought would receive a callback as each message came in. I was surprised to find out that the callback wasn’'t occuring. So I did some packet sniffing and sure enough, the packets were coming back but my callback was not being called. This led me to trying to place a PacketListener on the connection filtering for Message.class types. Sure enough, this worked.
Looking back at the original problem I started printing the thread id of the arriving messages and found out that it was null. This would explain why the chat.addMessageListener wasn’‘t working, as the filter it sets up uses the thread id to determine which messages qualify. null obviously didn’'t match the thread ID that my chat object was reporting.
So what needs to be done to get this to work by using chat.addMessageListener? Why don’'t arriving messages have a matching thread ID?