MessageListener V.S. PacketListener

New to JSP & Java…

I am using jsp right now and I am able to successfully send messages. The problem is not that the code will not listen, I just dont know how to create the ability to respond back automatically like a bot.

new MessageListener() {
     public void processMessage(Chat chat, Message message) {
                    
          System.out.println("Received message: " + message.getBody());
          chat.sendMessage("Howdy Bucky!!!"); // This didn't work.
          // ... need sendMessage     capability here!
     }
}

All replies to the initiating user are being logged successfully so i know that the code is listening. What code can I use in the commented section to send a reply?

Am I just approaching the situation wrongly? I was just trying to follow the example in the latest docs.

Figured it out.

Hi! I have the same problem.

What was the solution?