ra1u / redis-dart Goto Github PK
View Code? Open in Web Editor NEWfast redis protocol parser and client
License: MIT License
fast redis protocol parser and client
License: MIT License
Thanks for the good work.
Hello When I run a simple code
void main() async {
runApp(MyApp());
RedisConnection conn = new RedisConnection();
conn.connect('some_production_server_address',6379).then((Command command) {
PubSub pubsub = new PubSub(command);
pubsub.getStream().listen((message){
Fluttertoast.showToast(
msg: message.toString(),
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.CENTER,
timeInSecForIosWeb: 1,
backgroundColor: Colors.red,
textColor: Colors.white,
fontSize: 16.0,
);
// send object
command.send_object(["PUBLISH","monkey","banana"]);
});
});
}
I get this error
2021-01-12 15:54:38.405 3460-3488/com.dw.flutter_redis_sample E/flutter: [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: SocketException: OS Error: Connection refused, errno = 111, address = some_production_server_address, port = 39609
I have added this in the manifest
<uses-permission android:name="android.permission.INTERNET"/>
Also, I am using a real device.
I am using port 6379, I am not sure why this port used for 39609 (which also changes each time I restart the app)
otherwise we can not aot app with this library
Occurs when the redis service shuts down unexpectedly!
=====================================================================================
Unhandled exception:
SocketException: Write failed (OS Error: Broken pipe, errno = 32), address = 127.0.0.1, port = 63467
#0 _NativeSocket.write (dart:io-patch/socket_patch.dart:1119:34)
#1 _RawSocket.write (dart:io-patch/socket_patch.dart:1765:15)
#2 _Socket._write (dart:io-patch/socket_patch.dart:2198:18)
#3 _SocketStreamConsumer.write (dart:io-patch/socket_patch.dart:1946:26)
#4 _SocketStreamConsumer.addStream.<anonymous closure> (dart:io-patch/socket_patch.dart:1920:11)
#5 _rootRunUnary (dart:async/zone.dart:1444:13)
#6 _RootZone.runUnaryGuarded (dart:async/zone.dart:1623:7)
#7 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#8 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#9 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:733:19)
#10 _StreamController._add (dart:async/stream_controller.dart:607:7)
#11 _StreamController.add (dart:async/stream_controller.dart:554:5)
#12 _StreamSinkImpl.add (dart:io/io_sink.dart:136:17)
#13 _Socket.add (dart:io-patch/socket_patch.dart:2045:38)
#14 RedisConnection._sendraw
package:redis/connection.dart:75
#15 Command.send_object
package:redis/command.dart:27
#16 Cas.watch.<anonymous closure>
package:redis/cas.dart:31
#17 Future.doWhile.<anonymous closure> (dart:async/future.dart:535:26)
#18 _rootRunUnary (dart:async/zone.dart:1436:47)
#19 _CustomZone.runUnary (dart:async/zone.dart:1335:19)
#20 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
#21 _CustomZone.bindUnaryCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1281:26)
#22 Future.doWhile (dart:async/future.dart:551:18)
#23 Cas.watch
package:redis/cas.dart:29
Running dart run test --chain-stack-traces
yields the following:
00:05 +12 -1: test/cas_test.dart: Test Incr CAS Multiple [E]
SocketException: Connection failed (OS Error: Too many open files, errno = 24), address = localhost, port = 6379
dart:io Socket.connect
package:redis/connection.dart 21:19 RedisConnection.connect
test/main.dart 33:28 generate_connect
test/cas_test.dart 29:10 testincrcas
test/cas_test.dart 18:13 main.<fn>
===== asynchronous gap ===========================
dart:async _asyncThenWrapperHelper
test/cas_test.dart main.<fn>
00:05 +13 -1: Some tests failed.
I want to use ssl to connect, is it supported?
I'd like to see a few new commands with tests.
As for now INCR and DBSIZE. I suggest giving them their name in lowercase, e.g. incr
and dbsize
.
why does the following fail:
test("FLUSHALL test", () async {
Command cmd = await generate_connect();
await cmd.send_object("FLUSHALL");
});
Output:
00:01 +0 -1: FLUSHALL test [E]
RedisError(ERR unknown command `$8`, with args beginning with: )
00:01 +0 -1: loading test/flushall_test.dart
Consider enabling the flag chain-stack-traces to receive more detailed exceptions.
For example, 'pub run test --chain-stack-traces'.
00:01 +0 -1: Some tests failed.
whilst adding FLUSHALL to a list works
test("FLUSHALL test", () async {
Command cmd = await generate_connect();
await cmd.send_object( ["FLUSHALL"] );
});
The DISCARD method is currently not implemented.
I found quite a bit of spelling errors and bad wording in the README.md
I'm making a PR for it with improvements
There appears to be a breaking bug where once the client returns a RedisError
the Connection is permanently broken.
It's very easy to reproduce, just run the code below:
var redis = RedisConnection();
var cmd = await redis.connect("localhost", 6379);
await cmd.send_object(["GARBAGE"]).catchError((e){
print("***** Error GARBAGE -- $e");
});
await cmd.send_object(["get", "some_key",]).catchError((e){
print("***** Error Get some_key -- $e");
});
await cmd.send_object(["get", "some_other_key",]).catchError((e){
print("***** Error Get some_other_key -- $e");
});
The Get
commands fail with the same error as the GARBAGE
command
It looks like the bug was introduced here:
3110c8e#diff-0169e92992be999e9a9de7482d45357ffeaa22f5a9f2adaa974fafd3c62ab661L41
The future chaining that's going on with _future
I don't believe will work as expected since when the Future is completed with an error the successor will never be called.
config such as: '10.1.1.18:6739,12.19.13.14:6738'
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
Any plans on migrating to null-safety?
To all contributors of this redis-dart package. THIS is important!!!!!!
We would like to change current licence from GNU Affero General Public License v3.0 into MIT licence
@erf
@eknoes
@derrick56007
@ArnaudHeywear
@necessarylion
@Gabsop
@evanx
Why?
Simply put - Current licence requires that users disclose all source code using this library and sharing such code under the same licence.
For details follow wiki link https://en.wikipedia.org/wiki/GNU_Affero_General_Public_License and cosult legal department.
How to change?
Please write in comment below that you either
Thank you for your feedback and your contribution!
implement a way to automatically reconnect or resubscribe if the Redis server is restarted
void main() async {
await initRedisSubscribe();
}
...
Future<void> initRedisSubscribe() async {
var redisCommand = await getCurrentRedisConnection();
redisPubSub = PubSub(redisCommand);
redisPubSub.subscribe(['notification']);
final stream = redisPubSub.getStream();
var streamWithoutErrors = stream
.handleError((e) => print('NotificationService redisPubSub error $e'));
streamWithoutErrors.listen((msg) {
var kind = msg[0];
var data = msg[2];
if (kind == 'message') {
var map = jsonDecode(data);
var notification = Notification.fromMap(map);
sendNotifications(notification);
}
// else {
// print('received non-message ${msg}');
//}
});
}
I'm trying to use redis with a Dart API, but my environment is using sdk 2.2.0 and I'm getting version errors. Trying to use dependency_overrides
did not show any results.
First of all, thank you so much for your library! We are using your redis-dart in our project.
Everything works well for us except the close() on a redisconnection. It throws on the console: "[VERBOSE-2:ui_dart_state.cc(148)] Unhandled Exception: stream is closed", despite a try and catch in our call (see snippet below where _redisConnection is the "single" instance of RedisConnection())
Future closeRedisConnection() async {
bool _close;
try {
await _redisConnection.close();
_close = true;
} catch (onError) {
print('Redis Close Error: $onError');
}
return _close ?? false;
}
Hi. I am currently building a Flutter app and making use of the Redis package. I found the connection cannot be closed when I invoke cmd.get_connection().close()
until I close the app (Platform: Windows desktop, Edge, and Android app)
My flutter verison is: 3.13
Dart Version: Dart SDK version: 3.1.4 (stable) (Tue Oct 17 14:55:53 2023 +0000) on "windows_x64"
Redis package version: 4.0.0
Here below is a snippet of codes:
In file A, I have a function to create a Command:
//import 'package:flutter/foundation.dart';
import 'package:redis/redis.dart';
Future<Command> createCmd() async {
Command cmd = await RedisConnection().connect(
'my-redis-cloud-host', port);
await cmd.send_object([
"AUTH",
"account",
"secret"
]).then((var response) {
print(response);
});
return cmd;
}
In file B, I have other functions to use this Command I created in file A:
The function below will be called by 11 elements in a ListView at the same time.
Future<String> readGameRunningState(String gameId) async {
Command cmd = await createCmd();
String jobName = await cmd.send_object([
"GET",
"key",
]);
await cmd.get_connection().close();
var logger = Logger();
logger.d("Connection is closed!: jobName");
return jobName;
Any suggestion will be helpful. Thank you.
no work
Would you please create an example, maybe a complete main.dart file? I don't understand the syntax, so unfortunately I can't manage to connect to a Redis server.
Why does set
and get
commands return a Future?
(Nullable), when send_object
returns a Future
?
Could set/get be changed to always return a Future
?
Hi,
I am trying to update a JSON entry with the following command:
await Command.send_object((["JSON.SET", "myKey", "$.myfield", newValue]));
Issue is that "$.myfield" is not accepted by dart, it says "Expected an Identifier" and so it does not compile.
I tried to put $ alone like: "$", "json format.." but Dart still complains.. it does not like having a $.
Would someone know how to do a JSON UPDATE then using command.send_object ?
Thank you
Fabrice
First, thank you for great library that made me keep studying Dart with Redis!
Writing codes for wrapper to use like Map object, I made simple Function to deal with async calls:
(Part of whole code. If you are interested in it, please watch it at here.)
Function _redisCommander = (redisCommand) async {
Command command = await _redis.connect(host, port);
String authenticate = "OK";
if (password.isNotEmpty) {
authenticate = await command.send_object(["AUTH", password]);
}
if (authenticate == "OK") {
return command.send_object(redisCommand);
}
else {
throw new Exception("Incorrect password. Redis access is unauthorized.");
}
};
What I wonder is, 'close' may be required when 'connect' exists. And I found function 'close' on connection.dart file. I understood it closes socket connection. But there's no example code calling 'close' after operation.
How do I handle RedisConnection properly? Isn't it necessary to handle RedisConnection manually?
@ra1u Thanks for this great package.
Are there any plans of improving the api to match latest dart conventions e.g. improving function names, and better usage of the dart type system. Maybe i can help :)
Hi everyone,
I'm doing some tests with this package and I found a problem when interfacing with a redis on which topic messages are messagepack-packed data official site.
Until on topic there are strings only, this package has no problem using the following code:
_subscriber!.getStream().listen((event) {
print(event);
}
however, when I try to receive an "encoded" message like this:
which is shown as:
"\x91\x00"
on the redis-cli console tool on windows<Buffer 91 00>
on a node.js applicationI get
[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: FormatException: Unexpected extension byte (at offset 0)
#0 _Utf8Decoder.convertSingle (dart:convert-patch/convert_patch.dart:1789:7)
#1 Utf8Decoder.convert (dart:convert/utf.dart:318:42)
#2 Utf8Codec.decode (dart:convert/utf.dart:63:20)
#3 RedisParser.parseBulk.<anonymous closure>.<anonymous closure>
package:redis/redisparser.dart:95
#4 _rootRunUnary (dart:async/zone.dart:1436:47)
#5 _CustomZone.runUnary (dart:async/zone.dart:1335:19)
<asynchronous suspension>
#6 _CustomZone.bindUnaryCallbackGuarded.<anonymous closure> (dart:async/zone.dart)
<asynchronous suspension>
before the
subscriber!.getStream().listen
callback is called.
How can we fix this?
Thanks in advance
What do you think generally about rewriting the tests, using darts test package?
I think it would provide some improvements, as it makes it easier for new contributors to add & understand existing tests, it makes debugging easier when tests fail and if you like it would be easier to use Continuous Integration tools like Travis.
Redis package don't works on web, this is probably because it somewhere uses dart:io which is not supported on flutter web and the problem is there is no altenative to this!!
Facing same issue as #20 #49
tried with other service like app.redislabs.com and local redis server as well but facing the same issue also check redis.conf file where #requirepass is also commented.
%> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel unknown, 3.0.2, on macOS 13.1 22C65 darwin-arm, locale en-IN)
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
✗ cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.74.3)
[✓] Connected device (3 available)
[✓] HTTP Host Availability
! Doctor found issues in 1 category.
I noticed the "send_object" method is not using the lowerCamelCase syntax as recommended here there are also a few other methods using the underscores. Is there a spesific reason for this or would you like to change to this syntax? I would also suggest to rename "send_object" to just "send", and "send_nothing" to just "nothing". I understand this is a breaking change but i you could just bump the major version. What do you think?
I could make these changes..
Hi,
I was quite surprised that I couldn't get to more than 3800 PUBLISH commands from one Dart client to a local Redis in Docker. Running multiples of those clients increased the throughput linearly so as if the bottleneck is somehow the amount that a single dart process can send over the Redis connection.
Pure reading from pubs sub was better, I almost got the rate that multiple clients inserted into the pub sub channel (11k/s).
When trying to insert the received Data from pub-sub to a RedisStream with LPUSH
the throughput dropped again into the range of 3500/s.
Any idea what the reason could be?
void connectToPubSub(String channel) async {
pubSub!.subscribe([channel]);
final stream = pubSub!.getStream();
var streamWithoutErrors = stream.handleError((e) => print("error $e"));
await for (var msg in streamWithoutErrors) {
var kind = msg[0];
var jsonPayload = msg[2];
if (kind == "message") {
// final payload = jsonDecode(jsonPayload);
// await redisCommand?.send_object(
// ['XADD', 'soketi-stream', '*', 'payload', jsonPayload]);
await redisCommand
?.send_object(['LPUSH', 'soketi-queue', jsonPayload.toString()]);
} else {
print("received non-message ${msg}");
}
}
}
I noticed the pubsub.subscribe method is actually sending the redis psubscribe command.
Which is a problem when using the pubsub channels, numsub, etc commands.
if the value contains chinese chars, the value will loss any bytes,,
i have track the network bytes, it seems protocol not the latest?
Using the Redis-CLI, I can run a JSON.GET query such as
JSON.GET h4:9q9h 'd.[?(@.id=="e5dbaa67-c953-4903-bf79-682f82f8c42d")]'
But when I run this through redis-dart, I get an error such as
RedisError(JSON Path error: path error: \n$.'d.[?(@.id=="e5dbaa67-c953-4903-bf79-682f82f8c42d")]'\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n)
It looks like it's adding a $.
and that may be throwing off the byte boundaries? Has anyone else experienced this?
My RedisJSON key/value is structured like this
key: h4:9q9h
value: { d: [ { id: "e5dbaa67-c953-4903-bf79-682f82f8c42d" }, { id: "..." } ] }
We are using your redis-dart in our server. Really appreciate your work!
We suggest that the error/exception handling may be improved a little bit.
In short, when we do try{ await cmd.send_object( )}
or try{ pubSub.subscribe()}
, we may expect that we can easily capture all underlying errors/exceptions (no unhandled exception to crash the server). However, we found that the only way to capture all errors/exceptions are adding runZoned() to wrapper conn.connect()
or PubSub(cmd)
, which makes the upper-layer logic not every easy to organize.
Maybe registering stream error handlers from original socket across all underlying streams (e.g. lazystream) are a possible solution for this improvement?
The code snippets below are explaining the issue in details.
import 'dart:async';
import 'package:redis/redis.dart';
var local_host = '127.0.0.1';
var cmd_list = ['set', 'somekey', 'somevalue'];
main() async {
RedisConnection conn;
Command cmd;
//runZoned() help to capture exceptions for cmd.send_object()
await runZoned(() async {
conn = RedisConnection();
cmd = await conn.connect(local_host, 6379);
}, onError: (error) {
print('>>>>> captured by runZoned() wrapping RedisConnection.connect, error:$error');
});
while (true) {
await Future.delayed(Duration(seconds: 2));
//try{} cannot capture all exceptions here without using runZoned() above
//changing to use runZoned() here cannot capture all exceptions
try {
var result = await cmd.send_object(cmd_list);
print(result);
} catch (error) {
print('>>>>> captured by try{} wrapping Command.send_object, error:$error');
}
}
}
/*
* experiment steps
1.start a local redis server on terminal.
2.start this testing program.
3.then, kill the local redis server on terminal
4.saw exceptions are captured from multiple places
The output of this experiment
>>>>> captured by try{} wrapping Command.send_object, error:stream closed
>>>>> captured by runZoned() wrapping RedisConnection.connect, error:SocketException: OS Error: Connection reset by peer, errno = 54, address = 127.0.0.1, port = 54249
* */
import 'dart:async';
import 'package:redis/redis.dart';
var local_host = '127.0.0.1';
var cmd_list = ['set', 'somekey', 'somevalue'];
main() async {
RedisConnection conn;
Command cmd;
PubSub pubSub;
//runZoned() help to capture exceptions for pubSub.subscribe()
await runZoned(() async {
conn = RedisConnection();
cmd = await conn.connect(local_host, 6379);
}, onError: (error) {
print('>>>>> captured by runZoned() wrapping RedisConnection.connect, error:$error');
});
//runZoned() help to capture exceptions for pubSub.subscribe()
await runZoned(() async {
pubSub = await PubSub(cmd);
}, onError: (error) {
print('>>>>> captured by runZoned() wrapping PubSub, error:$error');
});
while (true) {
await Future.delayed(Duration(seconds: 2));
//try{} cannot capture all exceptions here without using runZoned() above
//changing to use runZoned() here cannot capture all exceptions
try {
pubSub.subscribe(['ch1', 'ch2', 'ch3']);
} catch (error) {
print('>>>>> captured by try{} wrapping PubSub.subscribe, error:$error');
}
}
}
/*
experiment steps
1.start a local redis server on terminal.
2.start this testing program.
3.then, kill the local redis server on terminal
4.saw exceptions are captured from multiple places
The output of this experiment
>>>>> captured by runZoned() wrapping PubSub, error:stream is closed
>>>>> captured by runZoned() wrapping RedisConnection.connect, error:SocketException: OS Error: Connection reset by peer, errno = 54, address = 127.0.0.1, port = 54256
* */
More of a question, but would it make sense that the api would return a type instead of just the string "OK" ? Or do we just pass the redis types?
Where do you pass the auth password, i see on the connection instance that there is only host and port required .
While building my app here: https://github.com/alexschneider/pub-search-engine
I decided to use this redis library because it has support for transactions, unlike the other one.
However, it appears that transactions fail with the exception:
Unhandled exception:
Uncaught Error: Bad state: No element
Stack Trace:
#0 ListQueue.removeFirst (dart:collection/queue.dart:555)
#1 Transaction.exec.<anonymous closure> (package:redis/transaction.dart:33:42)
#2 _RootZone.runUnary (dart:async/zone.dart:1155)
#3 _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:484)
#4 _Future._propagateToListeners (dart:async/future_impl.dart:567)
#5 _Future._complete (dart:async/future_impl.dart:348)
#6 _SyncCompleter.complete (dart:async/future_impl.dart:52)
#7 RedisConnection.senddummy.<anonymous closure>.<anonymous closure> (package:redis/connection.dart:35:40)
#8 _RootZone.runUnary (dart:async/zone.dart:1155)
#9 _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:484)
#10 _Future._propagateToListeners (dart:async/future_impl.dart:567)
#11 _Future._completeWithValue (dart:async/future_impl.dart:358)
#12 _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:412)
#13 _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41)
#14 _asyncRunCallback (dart:async/schedule_microtask.dart:48)
#15 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:84)
#16 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:131)
#0 _rootHandleUncaughtError.<anonymous closure> (dart:async/zone.dart:886)
#1 _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41)
#2 _asyncRunCallback (dart:async/schedule_microtask.dart:48)
#3 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:84)
#4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:131)
or if run in checked mode:
Unhandled exception:
Uncaught Error: 'package:redis/transaction.dart': Failed assertion: line 30 pos 16: 'list.length == _queue.length' is not true.
Stack Trace:
#0 Transaction.exec.<anonymous closure> (package:redis/transaction.dart:30:16)
#1 _RootZone.runUnary (dart:async/zone.dart:1155)
#2 _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:484)
#3 _Future._propagateToListeners (dart:async/future_impl.dart:567)
#4 _Future._complete (dart:async/future_impl.dart:348)
#5 _SyncCompleter.complete (dart:async/future_impl.dart:52)
#6 RedisConnection.senddummy.<anonymous closure>.<anonymous closure> (package:redis/connection.dart:35:40)
#7 _RootZone.runUnary (dart:async/zone.dart:1155)
#8 _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:484)
#9 _Future._propagateToListeners (dart:async/future_impl.dart:567)
#10 _Future._completeWithValue (dart:async/future_impl.dart:358)
#11 _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:412)
#12 _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41)
#13 _asyncRunCallback (dart:async/schedule_microtask.dart:48)
#14 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:84)
#15 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:131)
#0 _rootHandleUncaughtError.<anonymous closure> (dart:async/zone.dart:886)
#1 _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41)
#2 _asyncRunCallback (dart:async/schedule_microtask.dart:48)
#3 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:84)
#4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:131)
You can replicate my results by cloning my repo, cd
ing to bin/
and running dart server.dart
.
It appears to be an off by one error somewhere, when I checked in the debugger, list
had one more item than _queue
, and that the first two items appeared to be "OK"
in list
, not sure if there's an extra "OK"
in there or not...
How to set password please ?
Flutter
-> Redis auto-connect not working and also redis not connected in low network.
package socket_io_client many
Same as all option to socket .enableReconnection(),.setReconnectionDelay(1)...etc. but not any option redis if any time connection disconnect or not working then not error log print.
How to solve redis reconnection() or disconnect log?
i have used redis 4.0.0 package.
The LazyStream / StreamNext will return a Future.error(String):
https://github.com/ra1u/redis-dart/blob/master/lib/lazystream.dart#L62
It's hard to catch at a higher level and parse out what happened and what the system should do next.
Changing this to return a typed error would be easier to understand and work with.
Consider either a custom error that implements Exception or even just using StateError would be okay.
It works fine when I enable non SSL port in my Azure Cache for Redis. But when I enable SSL port 6380, this is the error I get: E/flutter ( 5132): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: SocketException: OS Error: Connection reset by peer, errno = 104, address = RedisAbhinav.redis.cache.windows.net, port = 44938
Code:
RedisConnection conn = new RedisConnection();
conn
.connect('SampleName.redis.cache.windows.net', 6380)
.then((Command command) {
command.send_object([
"AUTH",
"<YourKey>"
]).then((var response) {
print(response);
});
I'm not sure whether this library supports redis's ssl connection method
Hi,
first of all amazing work! Just what we currently need in our project.
I wonder, is it possible already to consume redis streams or Redis Lists in a blocking way (to wait for the next item bein inserted) or as Dar Streams?
I look into the redis package code, and it use socket to connect, but how to sent authentication(username and password), I cant connect without authentication
/// connect on Redis server as client
Future connect(host, port) {
return Socket.connect(host, port).then((Socket sock) {
_socket = sock;
disable_nagle(true);
_stream = LazyStream.fromstream(_socket!);
return Command(this);
});
}
I made a new PR #42, where i refactor the RedisConnection to take a socket as a constructor parameter, so it (and stream) becomes final and non-null
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.