If the list of strings passed as the first argument to the subscribe method contains more than 1 string, the following exception is raised:
RedisClientException: Received data without expecting any (Instance of 'MultiBulkReply').
#0 _RedisConnection._onRedisReply (package:redis_client/redis_client/redis_connection.dart:258:7)
#1 _RootZone.runUnaryGuarded (dart:async/zone.dart:1087)
#2 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341)
#3 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:270)
#4 _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:67)
#5 _EventSinkWrapper.add (dart:async/stream_transformers.dart:14)
#6 RedisStreamTransformerHandler.handleData (package:redis_client/transformer/transformer.dart:43:18)
#7 _HandlerEventSink.add (dart:async/stream_transformers.dart:216)
#8 _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:119)
#9 _RootZone.runUnaryGuarded (dart:async/zone.dart:1087)
#10 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341)
#11 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:270)
#12 _StreamController&&_SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:744)
#13 _StreamController._add (dart:async/stream_controller.dart:616)
#14 _StreamController.add (dart:async/stream_controller.dart:562)
#15 _Socket._onData (dart:io-patch/socket_patch.dart:1646)
#16 _RootZone.runUnaryGuarded (dart:async/zone.dart:1087)
#17 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341)
#18 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:270)
#19 _StreamController&&_SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:744)
#20 _StreamController._add (dart:async/stream_controller.dart:616)
#21 _StreamController.add (dart:async/stream_controller.dart:562)
#22 _RawSocket._RawSocket.<anonymous closure> (dart:io-patch/socket_patch.dart:1215)
#23 _NativeSocket.issueReadEvent.issue (dart:io-patch/socket_patch.dart:749)
#24 _microtaskLoop (dart:async/schedule_microtask.dart:43)
#25 _microtaskLoopEntry (dart:async/schedule_microtask.dart:52)
#26 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:96)
#27 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151)
The following code reproduces the issue, and after removing one of the channels it works as expected.
main(List<String> args) async {
var subscriberRedis = await RedisClient.connect();
subscriberRedis.subscribe(['channel1', 'channel2'], onSubscriberMessage);
}
onSubscriberMessage(Receiver receiver) async {
var reply = await receiver.receiveMultiBulkStrings();
print(reply);
}
I took a look at the subscribe method and it appears to expect a single MultiBulk reply, but it actually needs to receive one for each subscribed channel. It wasn't immediately clear how to do that, but I'll continue investigating.
If the list of strings passed as the first argument to the
subscribemethod contains more than 1 string, the following exception is raised:The following code reproduces the issue, and after removing one of the channels it works as expected.
I took a look at the subscribe method and it appears to expect a single MultiBulk reply, but it actually needs to receive one for each subscribed channel. It wasn't immediately clear how to do that, but I'll continue investigating.