Commit 212203e
authored
Merge pull request #18 from hpkv-io/feature/add-throttle
## Description
This pull request introduces a comprehensive adaptive request throttling system to the HPKV WebSocket Client SDK along with significant code restructuring and documentation improvements.
### Throttling Feature
- Added an **adaptive request throttling system** that dynamically adjusts request rates based on:
- Network latency (Round Trip Time measurements)
- Server responses (handling 429 Too Many Requests errors)
- Configurable rate limits
- Implemented queue management to ensure requests are processed optimally
- Added exponential backoff for handling rate-limited scenarios
- Provided monitoring capabilities for throttling metrics
### Code Refactoring
- Reorganized file structure for better modularity:
- Moved token management to utilities directory
- Restructured WebSocket adapters for browser and Node.js environments
- Consolidated exports in index files
- Enhanced error handling and message processing
- Improved type definitions and interfaces for better type safety
- Created new `SimpleEventEmitter` for efficient event handling
### Documentation Updates
- Added comprehensive documentation for the throttling feature in README.md
- Included configuration examples and monitoring instructions
- Added a table of contents for better navigation25 files changed
Lines changed: 1768 additions & 819 deletions
File tree
- sdk/node
- examples
- src
- clients
- utilities
- websocket
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
38 | 40 | | |
39 | 41 | | |
40 | 42 | | |
| |||
86 | 88 | | |
87 | 89 | | |
88 | 90 | | |
89 | | - | |
| 91 | + | |
90 | 92 | | |
91 | 93 | | |
92 | 94 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
8 | 12 | | |
9 | 13 | | |
10 | 14 | | |
| |||
0 commit comments