Some users are receiving messages destined to other users

Hello everyone,

I’ve been using Smack for months now, with an application that is already in production. This application is a website. Actually it’s a social network. This social network is very integrated with Facebook. So, since March, there’s a Facebook chat. The user gives xmpp_login permission to our application and it connects to the chat using Smack. There’s Javascript/HTML/CSS in the client-side and Grails with Smack in the server-side. The received message from Smack is passed to the client-side via websocket, using the socket API from Node.JS. Each client has an unique channel in this websocket, so they receive only the right messages.

There was no modification on this chat for some time and everything seemed to work very well. But some time ago, we discovered that there are cases when the user A starts to receive messages that was meant to be received by the person B. The person B also receives his own messages. When this happens, the user A receives all the messages from user B. But the user B doesn’t receive any messages from user A. It’s like the user A has acquired the identity of the user B.

We started to investigate and we can’t find where is the problem.

First, we thought that the problem could be in the channel. But the channel identifier is created with the user id plus a Hash of the user id. So, it’s supposed to be unique. The connection with Smack is hold by an object that belongs to the user’s session. So, I’m starting to think that the Smack’s MessageListener is receiving messages from other users. Maybe something has changed in the Facebook’s XMPP and the Smack is misunderstanding the packets, I don’t know.

I’m using the version 3.2.1 of the Smack.

Could someone tell me if the Smack is really meant to work in a multi user enviroment? Since it’s a social network, there are a lot of users connected at the same time.

Thanks in advance.

Enable Smack Debug and inspect the received stanzas. If the stanzas that contain messages for A are addressed to B then it’s not a Smack bug.