vukoye / xmpp_dart

Lightweight XMPP client library written in Dart
Apache License 2.0
83 stars 64 forks source link

Roster Manager Questions #51

Open Goutam192002 opened 3 years ago

Goutam192002 commented 3 years ago

I am trying to build a whatsapp clone. I decided to use ejabberd in the backend and flutter for frontend. For XMPP I decided to use this library.

In my application there's a flow like this

  1. Query XMPP for roster list
  2. If roster list is empty -> sync phonebook via REST API backend. Else, get roster list and write to sqlite db
  3. Display data from sqlite db to user.

Since the library requests for roster only at connectionState Ready https://github.com/vukoye/xmpp_dart/blob/3b1a0588562b9e591488c99d834088391840911d/lib/src/roster/RosterManager.dart#L99

Here's the problem I think I will face..

  1. XMPP Socket gets connected and is ready
  2. Send Request for roster
  3. Check if roster list is empty. If empty, sync via REST API.

Now the roster is updated in the backend.

But how to do I get this updated roster? I'm assuming here, if you can expose the queryForRoster method I can use it to query for the roster again. Please suggest any alternate mechanisms I can use.