connect method

void connect(
  1. Supervisor supervisor
)

Connect by the supervisor to start using discover users

Implementation

void connect(Supervisor supervisor) {
  supervisor.listen('search:all', (phoenixChannel) {
    this.phoenixChannel = phoenixChannel;
    phoenixChannel.messages.listen((event) async {
      if ( event.isReply ) {
        List<dynamic> userList = (event.payload!['response'])['users'];
        for(int i = 0; i < userList.length; i++) {
          discoveredUsers.add(LocalityUser(userList[i]['user_id'], userList[i]['public_key']));
        }
        notifyListeners();
      }
    });
    methodQueue.release();
  }, messagingTopic: false);
}