powered by Jive Software

How to persist users(MultiUserChat) and chat history in Openfire (Ver 4.0.3) using SMACK API (4.2.0 Beta1)

I have successfully created a multiuserchat group, but the user goes offline the user is removed from the group, and i want to have the history of messages to save for the user the next time he logs in. I found some approaches from previous and deduced as follows

  1. There are several old answers out there but none of them is based on new SMACK API 4.1.5+
  2. using “Stream Management”, but i have no idea what and how to do it, How it helps to solve my problem.
  3. Using a PUBSUB for getting messages and delivering to user and showing the pseudo-list of users.
    I want to know the best and effective approach or any libs which help to achieve my result. I am a newbie to XMPP and have 2+ year experience in java

NOTE: I am looking for a whatsapp group chat implementation to kick/invite/providing_permissions to the user and history of messages for notifications/when he is offline.

I am searching for this from long time , Any Help is really appreciated. Thanks in advance.

The same question is also available at stack overflow, please find at android - How to persist users(MultiUserChat) and chat history in Openfire (Ver 4.0.3) using SMACK API (4.2.0 Beta1) - S…


I’m also facing the same issue.

1 Like

I am facing this same issue in smack 4.1.9

facing the same issue …

1 Like

Tried a lot couldn’t find a solution. Pls help me

1 Like

I am also facing the same issue.

1 Like

Stuck in It. Somebody help me…

1 Like

Any work around for this ?

1 Like

Guys…I’m screwed …at this also…Pls …help…

Please help, we are at the middle of our project and because of this we can’t move forward.

Pls help its very urgent

1 Like

Guyz… i’m facing the same issue pls …give a solution

You can persist users, if you make the chat room members_only and add the users as members.

When joining the room, you simply get the list of all members as your room roster instead of the occupants. Members are also part of the chat room, even if they are offline.

For the room history you only have the default MUC history I guess.

Maybe you could look into Openfire’s Archive plugin + Smack’s MAM (XEP-0313) Support to achieve some history management.

Stream Management is not related to your problem.

What i do is like this:

  1. I create member only MUC for each Group server side.

  2. After the client logs in i try to join each room that the login is member of

  3. Now from the local Group table i have the last message time which is used while joining for getting history after that time.

  4. Group table is updated with last message time for each group once the listener receives message and stores in local DB.

  5. Thus it acts as a persistence group.

Thus user gets kikked of of room when he goes offline but while joining i get the history once he comes online that is what was required behavior.

  1. I create member only MUC for each Group server side.

In this case you can’t create dynamically right?

What I need is to add the users dynamically from Android client app.

I have a rest service to create groups

This user calls the rest service and then the service using openfire rest admin api creates the group on server. This makes it dynamic. You can also try a similar approach.

It would be more helpful if you can provide us a sample like creating a room with members_only

An example will be very helpful for all the viewer of this post

@Sai_Sarath found any solution?
Me also facing same issue. Even though showing room persistence in openfire, It kick the users after sometime and show only one user in that or some time it is empty