ra1u / redis-dart

fast redis protocol parser and client
MIT License
84 stars 35 forks source link

RedisRuntimeError(got element that cant not be parsed) #92

Open nhatpham0301 opened 10 months ago

nhatpham0301 commented 10 months ago

Redis version 4.0.0. Flutter 3.13.0-0.2.pre • channel beta • https://github.com/flutter/flutter.git Framework • revision ac71592bc6 (5 months ago) • 2023-07-18 14:53:57 -0600 Engine • revision e14db68a86 Tools • Dart 3.1.0 (build 3.1.0-262.2.beta) • DevTools 2.25.0

I connected success with redisconnection. But i can't use GET or SET of send_object.

My code:

RedisConnection conn = RedisConnection();
conn.connect('localhost', 8081).then((cmd) {
    debugPrint('success');
    cmd.send_object(["SET", "key", "value"]).then((value) {
        print(value);
      }).catchError((onError) {
        debugPrint('Error set redis: $onError');
      });
  }).catchError((onError) {
    debugPrint('Error connect redis: $onError');
  });

I always see error: RedisRuntimeError(got element that cant not be parsed)

Please point out my mistakes in the above syntax, thanks

ra1u commented 10 months ago

Hi.

I speculate, that you do not connect on raw redis server. When we do connect we just open socket and at that point no data is sent yet. Error seems to originate after parsing response from server after SET is sent and seems to be invalid.

Does connecting on localhost port 8081 with redis-cli work?

You can also try sniffing protocol between your client and redis databse using https://www.wireshark.org/ to get insights what is going on.