commit
9700f82b12
11 changed files with 21 additions and 21 deletions
|
@ -26,7 +26,7 @@ When `abort()` is called:
|
|||
|
||||
Generally, we have two parties in the process:
|
||||
1. The one that performs an cancelable operation, it sets a listener on `controller.signal`.
|
||||
2. The one one that cancels: it calls `controller.abort()` when needed.
|
||||
2. The one that cancels: it calls `controller.abort()` when needed.
|
||||
|
||||
Here's the full example (without `fetch` yet):
|
||||
|
||||
|
@ -50,7 +50,7 @@ As we can see, `AbortController` is just a means to pass `abort` events when `ab
|
|||
|
||||
We could implement same kind of event listening in our code on our own, without `AbortController` object at all.
|
||||
|
||||
But what's valuable is that `fetch` knows how to work with `AbortController` object, it's integrated with it.
|
||||
But what's valuable is that `fetch` knows how to work with `AbortController` object, it's integrated with it.
|
||||
|
||||
## Using with fetch
|
||||
|
||||
|
|
|
@ -217,8 +217,8 @@ Normally, when a document is unloaded, all associated network requests are abort
|
|||
|
||||
It has a few limitations:
|
||||
|
||||
- We can't send megabytes: the body limit for `keepalive` requests is 64kb.
|
||||
- We can't send megabytes: the body limit for `keepalive` requests is 64KB.
|
||||
- If we need to gather a lot of statistics about the visit, we should send it out regularly in packets, so that there won't be a lot left for the last `onunload` request.
|
||||
- This limit applies to all `keepalive` requests together. In other words, we can perform multiple `keepalive` requests in parallel, but the sum of their body lengths should not exceed 64kb.
|
||||
- We can't handle the server response if the document is unloaded. So in our example `fetch` will succeed due to `keepalive`, but subsequent functions won't work.
|
||||
- This limit applies to all `keepalive` requests together. In other words, we can perform multiple `keepalive` requests in parallel, but the sum of their body lengths should not exceed 64KB.
|
||||
- We can't handle the server response if the document is unloaded. So in our example `fetch` will succeed due to `keepalive`, but subsequent functions won't work.
|
||||
- In most cases, such as sending out statistics, it's not a problem, as server just accepts the data and usually sends an empty response to such requests.
|
||||
|
|
|
@ -70,7 +70,7 @@ As you can see, `subscribe` function makes a fetch, then waits for the response,
|
|||
```warn header="Server should be ok with many pending connections"
|
||||
The server architecture must be able to work with many pending connections.
|
||||
|
||||
Certain server architectures run one process per connection; resulting in there being as many processes as there are connections, while each process consumes quite a bit of memory. So, too many connections will just consume it all.
|
||||
Certain server architectures run one process per connection, resulting in there being as many processes as there are connections, while each process consumes quite a bit of memory. So, too many connections will just consume it all.
|
||||
|
||||
That's often the case for backends written in languages like PHP and Ruby.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue