You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-07-31 05:44:24 +03:00
Add the list of removed events to migration guide (#1761)
* Update v3-to-v4.md * Update README.md * Correct the wrong description * Update docs/v3-to-v4.md Co-authored-by: Simon Prickett <simon@crudworks.org> * Update docs/v3-to-v4.md Co-authored-by: Simon Prickett <simon@crudworks.org> Co-authored-by: Simon Prickett <simon@crudworks.org>
This commit is contained in:
@ -28,15 +28,31 @@ await client.connect();
|
||||
await client.ping();
|
||||
```
|
||||
|
||||
### No `message` event
|
||||
### All the removed events
|
||||
|
||||
In V4, you don't need to add listener to the `message` and `message_buffer` events, you can get the message directly in `subscribe`-like commands.
|
||||
The following events that existed in V3 were removed in V4:
|
||||
|
||||
1. `warning`
|
||||
2. `subscribe`
|
||||
3. `psubscribe`
|
||||
4. `unsubscribe`
|
||||
5. `message`
|
||||
6. `message_buffer`
|
||||
7. `messageBuffer`
|
||||
8. `pmessage`
|
||||
9. `pmessage_buffer`
|
||||
10. `pmessageBuffer`
|
||||
11. `monitor`
|
||||
|
||||
#### No `message`-like event
|
||||
|
||||
In V4, you don't need to add a listener to the `message`-like events (items 5 to 10 of the above list), you can get the message directly in `subscribe`-like commands.
|
||||
|
||||
The second argument of these commands is a callback, which will be triggered every time there is a message published to the channel.
|
||||
|
||||
The third argument to these commands is a boolean to set `bufferMode` (default `false`). If it's set to `true` you will receive a buffer instead of a string.
|
||||
|
||||
The `subscribe`-like commands return a promise. If the server returns `ok` the promise will be fulfilled, otherwise the promise will be rejected.
|
||||
The `subscribe`-like commands return a promise. If the command is executed successfully the promise will be fulfilled, otherwise the promise will be rejected.
|
||||
|
||||
```typescript
|
||||
import { createClient } from 'redis';
|
||||
|
Reference in New Issue
Block a user