Messages duplication with web socket

Openfire 4.8.1
Monitoring Service 2.5.0

Hi, i’m facing this issue:

  • single client connected in browser through websocket;
  • send a message with any other client;
  • the client connected in browser receives the message
  • refresh the page in browser, the message is received again and i see the message archived 2 times in the [ofMessageArchive] table, instead of a single one

it seems something like the browser client does not “ack” the received message, so openfire sends it again.
It is possible? Is there some ack mechanism in xmpp, missing in this case?
Or any other idea?
Thanks very much.

I’m not exactly sure what you mean.

Are these one-to-one messages, or messages in exchanged in a chat room?

Is the message duplicated in the database only after you refresh the browser?

Are you using two different accounts to send and receive the message? If that’s the case, then what you’re seeing might be the message saved for both users: one as the sender, and one as the recipient of the message.

Would it be possible for you to give us an exact copy of the database content?

Hi guus, thanks for your kind reply.

Are these one-to-one messages, or messages in exchanged in a chat room?

they are one-to-one messages

Is the message duplicated in the database only after you refresh the browser?

yes, exactly, the message is duplicated at the instant when i press the refresh button, not after i make the login with the WS client

Are you using two different accounts to send and receive the message? If that’s the case, then what you’re seeing might be the message saved for both users: one as the sender, and one as the recipient of the message.

yes, i use 2 different accounts, one for sending, another to receive. I don’t think this is the case, because if i send n messages, the are randomly duplicated (each one with 2 records in [ofMessageArchive] and 1 in [ofOffline])

Would it be possible for you to give us an exact copy of the database content?

It is a sql server db, if necessary i can take a backup

Thanks

Why do you think that this is not ‘correct’ behavior?

When two users exchange a message, I do expect that message to be stored in ofMessageArchive twice: once for each user.

The ofOffline table is used only (and not for all clients) to store a message that is sent to a message that is offline. When the client comes online, it will obtain the ‘offline’ message from that database table, and clear it from the table.

The ofOffline table is for similar (but older) functionality as what ofMessageArchive is used for. A difference between the two is that ofOffline is expected to be used only until the client comes online, and retrieves all messages that were sent to it while it was offline. ofMessaggeArchive will typically not be ‘cleaned’ in the same way.

Hi, i think that it is not a correct behavior because if i use, for example, Psi and Pidgin as clients (Psi as receiver and Pidgin as sender, with same two different users) i always see just one message in ofMessageArchive table.
If i turn offline Psi and go online with web WS client, the problem starts again.