|
1 | 1 | # Migrating to v4.x
|
2 | 2 |
|
3 |
| -This migration guide helps you transition an application written using the `v3.x` series of this package, to the `v4.x` series. This guide focuses specifically on the breaking changes to help get your existing app up and running as quickly as possible. In some cases, there may be better techniques for accomplishing what your app already does by utilizing brand new features or new API. Learn about all the new features in our [`v4.0.0` release notes](https://github.com/slackapi/node-slack-sdk/releases/tag/v4.0.0) if you'd like to go beyond a simple port. |
| 3 | +This migration guide helps you transition an application written using the `v3.x` series of this package, to the `v4.x` series. This guide focuses specifically on the breaking changes to help get your existing app up and running as quickly as possible. In some cases, there may be better techniques for accomplishing what your app already does by utilizing brand new features or new API methods. Learn about all the new features in our [`v4.0.0` release notes](https://github.com/slackapi/node-slack-sdk/releases/tag/v4.0.0) if you'd like to go beyond a simple port. |
4 | 4 |
|
5 | 5 | ## WebClient
|
6 | 6 |
|
@@ -80,7 +80,7 @@ The datastore APIs have helped apps keep track of team state since this feature
|
80 | 80 |
|
81 | 81 | At a high level, here are the design issues that could not be addressed in a backwards compatible way:
|
82 | 82 |
|
83 |
| -- **Synchronous calling convention** - In order to plug in storage destinations other than memory (`SlackMemoryDataStore`) the code to reach that destination would need to be asynchronous. This is important if you want to share state across many processes while horizontally scaling an app. As a result, the maintainers have never seen an implementation of the `SlackDataStore` interface other than the memory-based one provided. |
| 83 | +- **Synchronous calling convention** - In order to plug in storage destinations other than memory (`SlackMemoryDataStore`), the code to reach that destination would need to be asynchronous. This is important if you want to share state across many processes while horizontally scaling an app. As a result, the maintainers have never seen an implementation of the `SlackDataStore` interface other than the memory-based one provided. |
84 | 84 |
|
85 | 85 | - **Names versus IDs** - While we always thought it was a good idea to use IDs anywhere possible in programmatic use, the Slack platform wasn't overly strict about it. With the introduction of Shared Channels, we cannot preserve any guarantees of uniqueness for usernames, as we mentioned in this [changelog entry](https://api.slack.com/changelog/2017-09-the-one-about-usernames). In fact, channel names also lose these types of guarantees. The APIs in the `SlackDataStore` that operate on names instead of IDs start to break since the fundamental assumptions are not true anymore.
|
86 | 86 |
|
@@ -119,7 +119,7 @@ If you aren't sure how to translate a specific data store method into a Web API
|
119 | 119 |
|
120 | 120 | You'll notice that this code has become asynchronous. This will likely be the largest challenge in migrating away from the data store, but for most developers it will be worth it.
|
121 | 121 |
|
122 |
| -For the majority of apps, you will be ready for v4 at this point. If your app is having performance related issues, there's room to make improvements by caching the data that is relevant to your app. This should only be taken on if you believe its necessary, since cache invalidation is one of the [only two hard things in computer science](https://martinfowler.com/bliki/TwoHardThings.html). |
| 122 | +For the majority of apps, you will be ready for v4 at this point. If your app is having performance related issues, there's room to make improvements by caching the data that is relevant to your app. This should only be taken on if you believe it's necessary, since cache invalidation is one of the [only two hard things in computer science](https://martinfowler.com/bliki/TwoHardThings.html). |
123 | 123 |
|
124 | 124 | The approach for caching data that we recommend is to pick out the data your app needs, store it at connection time, and update it according to a determined policy. You may want to disable the `useRtmConnect` option in order
|
125 | 125 | to get more data at connection time.
|
@@ -197,7 +197,7 @@ rtm.addOutgoingEvent(true, message.type, message)
|
197 | 197 | });
|
198 | 198 | ```
|
199 | 199 |
|
200 |
| -### Events |
| 200 | +### Events {#events} |
201 | 201 |
|
202 | 202 | The `RTMClient` now has more well-defined states (and substates) that you may observe using the [`EventEmitter` API pattern](https://nodejs.org/api/events.html). The following table helps describe the relationship between events in the `v3.x` series and events in the `v4.x` series.
|
203 | 203 |
|
|
0 commit comments