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

Cannot subscribe to more than 1 channel #63

Open
andreleblanc-wf opened this issue Jan 26, 2016 · 1 comment
Open

Cannot subscribe to more than 1 channel #63

andreleblanc-wf opened this issue Jan 26, 2016 · 1 comment

Comments

@andreleblanc-wf
Copy link

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.

@andreleblanc-wf
Copy link
Author

Here's my solution: #64

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