Using smack with google :some issues

Hi,

I’m integrating smack with a VXML server (to get IM automation), and have an issue when using it with gtalk. My server looks just like another gtalk user (eloquanttest) and responds to chats as another user would…

Generally it works ok but:

  • gtalk seems to set a new threadId for every message, hence smack sees every message as a new Chat (and the MessageListener is never called!). I have worked round this as suggested elsewhere by keeping a record of all connected users and re-using the same client object, but this is kind of clunky. Anyone know if this is ‘good’ behaviour or is there a ‘right’ way to deal with this?

  • is there a way to be notified when a new user ‘starts’ a chat window? It seems like I only get a notification when the first message is actually sent, and not for activities such as opening or closing the chat window? I guess this might be client specific?

  • big issue : it works ok when the other user connects using the “real” gtalk client, but if they are a user created by the “chatback badge” for my vxml user account, then this either never connects to me, or sends a load of messages that smack doesn’t seem to understand. Has anyone got smack to work with the chatback badge gadget?

  • debug : if I enable the smack debug, this pops up a nice debug window to examine the messages etc. However, in a server linux headless environment this isn’t quite so good. How do I get the same debug info (dump of messages in/out etc) out to a debug log?

thanks for any help you can give me, and keep up the good work guys!

brian.wyld wrote:

  • gtalk seems to set a new threadId for every message, hence smack sees every message as a new Chat (and the MessageListener is never called!). I have worked round this as suggested elsewhere by keeping a record of all connected users and re-using the same client object, but this is kind of clunky. Anyone know if this is ‘good’ behaviour or is there a ‘right’ way to deal with this?

Well, this happens because the other side doesn’t preserve the ThreadId, otherwise it would be automatic. Hence we use the participantId to identify chat sessions.

  • is there a way to be notified when a new user ‘starts’ a chat window? It seems like I only get a notification when the first message is actually sent, and not for activities such as opening or closing the chat window? I guess this might be client specific?

smack has a ChatStateListener, but I found it to be very buggy. You might be able to work around by rolling your own with PacketListeners. I don’t know if Spark uses chat states, but you can have a peek at its source code.

cheers!

For the threadId, I ended up doing that (hashmap of users)

Any ideas for the google chatbox?

Brian

Hmmm. I think I see the problem : gtalk sends the following message to my chat vxml user:

Someone clicked on your chatback badge: Eloquant test service

Click here to join: http://talkgadget.google.com/talkgadget/joinpmuc?r=CqICzwmk4Rp48JOuVMcpKxvb-GyVB lDQ8RwX4W-PpwyX06-6AllwHankhQvHJob4ERWNraOAMFgHTaWXx7gcwG9Tehgx8FA2e_dp4hF89kfFS xSg6mocdNh88BOa_irRxxNQl2xr8ZMeOZZxtqeg77MbYRTCottZs9hb0Ekh5aON5CwGEeMm_Np5QAUyO jnKpxwdiUja6I2NBavUOgOKwVTVLoogXrBUdHatK2oA5Mnb6f9SMtSxTY8GIwxDWBBOyFEVk5xcTLlHh yY_1j9mtsibYxo7wtwjahb3sipJAJi_Hg1IVp3wZlnR5ssquhNDH10LfHLZELxp3fiV6-IEecqsv8tI- sMsYaKi7XKYdn7pf09q4fhfDqiAd9apXNnIYrYMP7oSDPlyva7XnBHThyn8aRgB&si=1

And my chat client takes that as a new chat (as its a new message) and obviously can’t ‘click’ on the link…

Anyone any experience with these chatback badges?

cheers