You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/v3-to-v4.md
+17-19Lines changed: 17 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -16,15 +16,16 @@ The configuration object passed to `createClient` has changed significantly with
16
16
17
17
### No Auto Connect
18
18
19
-
In V4, the client will not be auto connected to the server, you need to run `.connect()` before any command, or you will receive error `Uncaught ClientClosedError: The client is closed`.
19
+
In V4, the client will not be auto connected to the server, you need to run `.connect()` before any command, or you will receive error `ClientClosedError: The client is closed`.
20
20
21
-
```javascript
22
-
constredis=require("redis");
23
-
constclient=redis.createClient();
21
+
```typescript
22
+
import { createClient } from'redis';
24
23
25
-
client.connect().then(() => { // the connect method returns promise!
26
-
returnclient.select();
27
-
});
24
+
const client =createClient();
25
+
26
+
awaitclient.connect();
27
+
28
+
awaitclient.ping();
28
29
```
29
30
30
31
### No `message` event
@@ -37,18 +38,15 @@ The third agrument of commands is a boolean to set `bufferMode` (default `false`
37
38
38
39
The `subscribe`-like commands return a promise, if the server returns `ok` the promise will be fulfilled, otherwise the promise will be rejected.
39
40
40
-
```javascript
41
-
constredis=require("redis");
42
-
constsubscriber=redis.createClient();
43
-
44
-
subscriber.connect().then(() => { // the connect method returns promise!
0 commit comments