Skip to content

Commit c0fd245

Browse files
committed
fixup! Add stall detection to recover from frozen uploads
1 parent cd3d301 commit c0fd245

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

docs/api.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ An object used as the HTTP stack for making network requests. This is an abstrac
354354
interface HttpStack {
355355
createRequest(method: string, url: string): HttpRequest;
356356
getName(): string;
357+
supportsProgressEvents(): boolean;
357358
}
358359

359360
interface HttpRequest {
@@ -395,6 +396,14 @@ interface HttpResponse {
395396

396397
```
397398

399+
The `supportsProgressEvents()` method should return `true` if the HTTP stack implementation supports progress events during upload, or `false` otherwise. This is used by tus-js-client to determine whether features like stall detection can be enabled. The built-in HTTP stacks have the following support:
400+
401+
- `XHRHttpStack` (browser default): Returns `true` - XMLHttpRequest supports progress events
402+
- `NodeHttpStack` (Node.js default): Returns `true` - Node.js HTTP module supports progress events
403+
- `FetchHttpStack`: Returns `false` - Fetch API does not support upload progress events
404+
405+
If you're implementing a custom HTTP stack, you should return `true` only if your implementation can reliably call the progress handler set via `setProgressHandler` during the upload process.
406+
398407
#### urlStorage
399408

400409
_Default value:_ Environment-specific implementation

0 commit comments

Comments
 (0)