1

I've successfully deployed a ejabberd server and integrated it with a mobile application.

Everything works great, however, every time I restart the server, the history of every room is lost. Actually, it is still stored in the database, but the client isn't able to retrieve it anymore.

Initially I thought it was a client issue, but I've experienced the same using well-known clients such as Xabber and Pidgin.

I checked multiple times the configuration tutorial https://docs.ejabberd.im/admin/configuration/#mod-muc but I haven't found anything.

Has anything similar ever happened to you guys? What could be the reason behind this unexpected behavior?

Here's how moc_muc is configured on the server:

mod_muc:
    host: "conf.example.com"
    history_size: 1000
    max_users: 1000000
    max_user_conferences: 1000
    default_room_options:
      mam: true
      max_users: 1000000
      members_by_default: true
      members_only: false
      password_protected: false
      persistent: true
      public: true
      moderated: false
      anonymous: false
womble
  • 95,029
  • 29
  • 173
  • 228
pAkY88
  • 201
  • 4
  • 10

1 Answers1

3

every time I restart the server, the history of every room is lost.

The room recent discussion history is keep only in RAM, because it isn't expected to be stored permanently. It is configured with the option history_size, and it doesn't make sense to set a high value, as it only allows a new occupant to know recent comments in the current discussion. It is not for logging, it is not for storage, not for archiving, it is only to know what the current conversation is. See https://xmpp.org/extensions/xep-0045.html#enter-history

Actually, it is still stored in the database, but the client isn't able to retrieve it anymore.

What you see stored in the database technically is not the room "discussion history" mentioned before; that is room discussion archiving, that you enabled with mam option. That stores all the room messages, persistently, in a database. So they can be consulted anytime in the future. See https://docs.ejabberd.im/admin/configuration/#mod-mam

Badlop
  • 540
  • 3
  • 5
  • Hi @Badlop, thanks for your answer. If mam is enabled and room messages are stored in a MySQL database, is there any way to retrieve them after the server is restarted? Should I retrieve them using XEP-0313 https://xmpp.org/extensions/xep-0313.html#query ? – pAkY88 Apr 29 '18 at 15:33
  • 1
    Right, send an IQ query specifying a TO attribute with the room JID, for example: `...` – Badlop Apr 29 '18 at 19:37