hprose / hprose-dart

Hprose 3.0 for Dart
https://pub.dev/packages/hprose
MIT License
31 stars 8 forks source link

callback of prosumer.subscribe dont work #4

Closed saber2coder closed 4 years ago

saber2coder commented 4 years ago

i use the demo code on a flutter demo to test push await prosumer1.subscribe('test', (message) { print('112233'); print(message); print(message.toJson()); }); final r1 = prosumer2.push('hello', 'test');

but i view the log only get these I/flutter (13244): Hm1{s2"id"u1}Cu+a1{s4"test"}z I/flutter (13244): Rtz I/flutter (13244): Hm1{s2"id"u1}Cu<z I/flutter (13244): Hm1{s2"id"u2}Cs2">*"a2{s5"hello"s4"test"}z I/flutter (13244): Rm1{s4"test"a1{c1"@"2{s4"data"s4"from"}o0{s5"hello"u2}}}z I/flutter (13244): Rm1{u1t}z I/flutter (13244): the result of push [{1: true}] I/flutter (13244): Hm1{s2"id"u1}Cu<z I/flutter (13244): Hm1{s2"id"u1}Cu-a1{s4"test"}z I/flutter (13244): Rnz I/flutter (13244): Rtz

dont get my log "112233"

hope for answer

andot commented 4 years ago

I/flutter (13244): Hm1{s2"id"u2}Cs2">*"a2{s5"hello"s4"test"}z // from prosumer2.push I/flutter (13244): Rm1{s4"test"a1{c1"@"2{s4"data"s4"from"}o0{s5"hello"u2}}}z // push to prosumer1

It seems to work normally. Maybe you execute unsubscribe too early.