Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onPres can not will be triggered when a pres message is received #19

Open
c1s1x1 opened this issue Oct 12, 2021 · 0 comments
Open

onPres can not will be triggered when a pres message is received #19

c1s1x1 opened this issue Oct 12, 2021 · 0 comments

Comments

@c1s1x1
Copy link

c1s1x1 commented Oct 12, 2021

lib/src/models/server-messages.dart

static PresMessage fromMessage(Map<String, dynamic> msg) {
    return PresMessage(
      topic: msg['msg'],
      src: msg['src'],
      what: msg['what'],
      seq: msg['seq'],
      clear: msg['clear'],
      delseq:
          msg['delseq'] != null && msg['delseq'].length != null ? msg['delseq'].map((seq) => DeleteTransactionRange.fromMessage(seq)).toList() : [],
      ua: msg['ua'],
      act: msg['act'],
      tgt: msg['tgt'],
      acs: msg['acs'] != null ? AccessMode(msg['acs']) : null,
      dacs: msg['dacs'] != null ? AccessMode(msg['dacs']) : null,
    );
  }
}

需要改为

static PresMessage fromMessage(Map<String, dynamic> msg) {
    return PresMessage(
      topic: msg['topic'],
      src: msg['src'],
      what: msg['what'],
      seq: msg['seq'],
      clear: msg['clear'],
      delseq:
          msg['delseq'] != null && msg['delseq'].length != null ? msg['delseq'].map((seq) => DeleteTransactionRange.fromMessage(seq)).toList() : [],
      ua: msg['ua'],
      act: msg['act'],
      tgt: msg['tgt'],
      acs: msg['acs'] != null ? AccessMode(msg['acs']) : null,
      dacs: msg['dacs'] != null ? AccessMode(msg['dacs']) : null,
    );
  }
}

否则

grp!.onPres.listen

无法获取到最新的数据

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant