Project

General

Profile

Update the user's rosters directly at the tigase database. Issue, when jabber client at this moment is online.

Dmitry Anatolievich
Added over 4 years ago

Hello, everyone.

I add/update/delete user's rosters directly at the tigase database to improve performance. I have stored procedure for this.

At the table tig_pairs i add/update/delete the section: **.

For example, i have 2 users: u1 and u2.

I add to tig_pairs:

for u1:

for u2:

It works for me, if jabber client of each user is offline. I use Psi, as client.

But i noticed, that if jabber client of, says, u1 is online and i run my procedure:

  1. database updated (records is added to tig_pairs table), but jabber client of u1 is not updated.

  2. as result when i offline the client of u1*, the record at the *tig_pairs table for u1 is overwritten by the empty value.

It happens, because after changing of the database, i don't update jabber client, so when i offline it, client writes to databse its previous roster value. And it is empty.

I checked the same through Ad-Hoc command ("user-roster-management-ext", as this https://repository.tigase.org/reps/tigase-testsuite/trunk/tests/data/AdHocRosterAddBoth.cot).

And i see that in this case server adds records to tig_pairs table, and after this!!! it sends some command to client, and client itself updates its roster.

So if in this case i offline the u1 client, the record is overwritten too, but in this case it is correct, because before client updated it.

So, I need your help. Any ideas. How can i automaticaly update online jabber clients.

Maybe here's another solution for my task? Because Ad-Hoc command does not fit me. It is very slowly for my number of users. I need update roster for more then 200 user at the same time.

Thx.


Replies (5)

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam over 4 years ago

The best solution is probably to combine your approach with the existing roster management command. You can update user's roster directly in DB and then you can execute ad-hoc command to send notification to online users about roster change.

Added by Dmitry Anatolievich over 4 years ago

Hello, Artur.

Thanks for your reply.

But what roster management command do you mean? What ad-hoc command can i use to send notification to online users?

Thx. It is very important for me.

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam over 4 years ago

There are a few already, one of which is this ""user-roster-management-ext"" you mentioned about in your own post. There is probably none of the ad-hoc commands you can use out of the box but you can use them as a code example to implement your own. Most of the roster management commands deal with online users correctly and send notifications about roster change.

Added by Dmitry Anatolievich over 4 years ago

Hello, Artur.

Thx for your reply.

I saw the existing ad-hoc commands (scripts). And i see, that they do push roster operation (through rosterUtil.updateBuddyChange() method).

And if i will use this approach, i will need execute push operation several times for one client.

Says, i have u1*, *u2 and u3 clients.

So, for u1 i will execute push operation twice (u2 jid and u3 jid); for u2 - twice too (u1 jid and u3 jid); for u3 - twice too (u1 jid and u2 jid).

And if I will have 200 users or more, it will run for a long time, i think. Maybe I'm wrong. Pls, correct me if so.

Do i have the possibilty to send from server (from my own ad-hoc script) to client one command, after that client updates its roster?

If you have some samples or codes, please show me.

Thx and best regards.

Added by Dmitry Anatolievich over 4 years ago

Hello, Artur.

I implemented my own ad-hoc command, that updated the online client's rosters.

Thx for your replies.

    (1-5/5)