Problem while chatting with 2 or more contact

Hello, I’m working on a Xmpp client. I have some trouble, to handle more than one chat. I first contact the first buddy, then I contact the other one, and seems works…but when I try to contact again the first one, nothing happen. I’m not sure about the connection managment, in fact I alway create a new chat object, when I send a new message.Do I have to use the same chat ID?And How?Can someone paste some code for the managment of many chat at the same time?

p.s. scuse me for my english, and thanks!

Keep the chat instance and reuse it for the same chat. Creating a new one each time will create a new chat with a new thread id. Incoming messages will get delivered to the chat matching the thread id, which will be the first one you created if the other end supports thread id’s.