wse-client 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +222 -0
  3. package/dist/constants.d.ts +195 -0
  4. package/dist/constants.d.ts.map +1 -0
  5. package/dist/constants.js +285 -0
  6. package/dist/constants.js.map +1 -0
  7. package/dist/examples/ChatHandlers.d.ts +15 -0
  8. package/dist/examples/ChatHandlers.d.ts.map +1 -0
  9. package/dist/examples/ChatHandlers.js +20 -0
  10. package/dist/examples/ChatHandlers.js.map +1 -0
  11. package/dist/examples/IoTHandlers.d.ts +12 -0
  12. package/dist/examples/IoTHandlers.d.ts.map +1 -0
  13. package/dist/examples/IoTHandlers.js +15 -0
  14. package/dist/examples/IoTHandlers.js.map +1 -0
  15. package/dist/handlers/EventHandlers.d.ts +17 -0
  16. package/dist/handlers/EventHandlers.d.ts.map +1 -0
  17. package/dist/handlers/EventHandlers.js +20 -0
  18. package/dist/handlers/EventHandlers.js.map +1 -0
  19. package/dist/handlers/index.d.ts +14 -0
  20. package/dist/handlers/index.d.ts.map +1 -0
  21. package/dist/handlers/index.js +37 -0
  22. package/dist/handlers/index.js.map +1 -0
  23. package/dist/hooks/useWSE.d.ts +42 -0
  24. package/dist/hooks/useWSE.d.ts.map +1 -0
  25. package/dist/hooks/useWSE.js +1224 -0
  26. package/dist/hooks/useWSE.js.map +1 -0
  27. package/dist/index.d.ts +25 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +48 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/protocols/compression.d.ts +17 -0
  32. package/dist/protocols/compression.d.ts.map +1 -0
  33. package/dist/protocols/compression.js +155 -0
  34. package/dist/protocols/compression.js.map +1 -0
  35. package/dist/protocols/transformer.d.ts +12 -0
  36. package/dist/protocols/transformer.d.ts.map +1 -0
  37. package/dist/protocols/transformer.js +76 -0
  38. package/dist/protocols/transformer.js.map +1 -0
  39. package/dist/services/AdaptiveQualityManager.d.ts +44 -0
  40. package/dist/services/AdaptiveQualityManager.d.ts.map +1 -0
  41. package/dist/services/AdaptiveQualityManager.js +114 -0
  42. package/dist/services/AdaptiveQualityManager.js.map +1 -0
  43. package/dist/services/ConnectionManager.d.ts +92 -0
  44. package/dist/services/ConnectionManager.d.ts.map +1 -0
  45. package/dist/services/ConnectionManager.js +852 -0
  46. package/dist/services/ConnectionManager.js.map +1 -0
  47. package/dist/services/ConnectionPool.d.ts +74 -0
  48. package/dist/services/ConnectionPool.d.ts.map +1 -0
  49. package/dist/services/ConnectionPool.js +430 -0
  50. package/dist/services/ConnectionPool.js.map +1 -0
  51. package/dist/services/EventSequencer.d.ts +30 -0
  52. package/dist/services/EventSequencer.d.ts.map +1 -0
  53. package/dist/services/EventSequencer.js +152 -0
  54. package/dist/services/EventSequencer.js.map +1 -0
  55. package/dist/services/MessageProcessor.d.ts +69 -0
  56. package/dist/services/MessageProcessor.d.ts.map +1 -0
  57. package/dist/services/MessageProcessor.js +1050 -0
  58. package/dist/services/MessageProcessor.js.map +1 -0
  59. package/dist/services/NetworkMonitor.d.ts +34 -0
  60. package/dist/services/NetworkMonitor.d.ts.map +1 -0
  61. package/dist/services/NetworkMonitor.js +143 -0
  62. package/dist/services/NetworkMonitor.js.map +1 -0
  63. package/dist/services/OfflineQueue.d.ts +25 -0
  64. package/dist/services/OfflineQueue.d.ts.map +1 -0
  65. package/dist/services/OfflineQueue.js +117 -0
  66. package/dist/services/OfflineQueue.js.map +1 -0
  67. package/dist/services/RateLimiter.d.ts +25 -0
  68. package/dist/services/RateLimiter.d.ts.map +1 -0
  69. package/dist/services/RateLimiter.js +85 -0
  70. package/dist/services/RateLimiter.js.map +1 -0
  71. package/dist/stores/useMessageQueueStore.d.ts +23 -0
  72. package/dist/stores/useMessageQueueStore.d.ts.map +1 -0
  73. package/dist/stores/useMessageQueueStore.js +188 -0
  74. package/dist/stores/useMessageQueueStore.js.map +1 -0
  75. package/dist/stores/useWSEStore.d.ts +54 -0
  76. package/dist/stores/useWSEStore.d.ts.map +1 -0
  77. package/dist/stores/useWSEStore.js +464 -0
  78. package/dist/stores/useWSEStore.js.map +1 -0
  79. package/dist/types.d.ts +403 -0
  80. package/dist/types.d.ts.map +1 -0
  81. package/dist/types.js +39 -0
  82. package/dist/types.js.map +1 -0
  83. package/dist/utils/circuitBreaker.d.ts +35 -0
  84. package/dist/utils/circuitBreaker.d.ts.map +1 -0
  85. package/dist/utils/circuitBreaker.js +145 -0
  86. package/dist/utils/circuitBreaker.js.map +1 -0
  87. package/dist/utils/logger.d.ts +46 -0
  88. package/dist/utils/logger.d.ts.map +1 -0
  89. package/dist/utils/logger.js +231 -0
  90. package/dist/utils/logger.js.map +1 -0
  91. package/dist/utils/security.d.ts +74 -0
  92. package/dist/utils/security.d.ts.map +1 -0
  93. package/dist/utils/security.js +383 -0
  94. package/dist/utils/security.js.map +1 -0
  95. package/package.json +63 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 WSE Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,222 @@
1
+ # WSE — WebSocket Engine
2
+
3
+ **Up to 1.1M msg/s. End-to-end encrypted. Rust-accelerated.**
4
+
5
+ <!-- badges: pypi, npm, ci, coverage, license -->
6
+
7
+ ---
8
+
9
+ ## Performance
10
+
11
+ Rust-accelerated engine via PyO3. Benchmarked on Apple M3 Max, single process, 1KB JSON.
12
+
13
+ | Mode | Throughput | Latency (p50) | Latency (p99) |
14
+ |------|-----------|---------------|---------------|
15
+ | **Rust (binary)** | **1,100,000 msg/s** | **0.009 ms** | **0.04 ms** |
16
+ | **Rust (JSON)** | **285,000 msg/s** | **0.03 ms** | **0.15 ms** |
17
+ | Pure Python | 106,000 msg/s | 0.09 ms | 0.4 ms |
18
+
19
+ Compared to alternatives:
20
+
21
+ | Library | Throughput | Encrypted | Priority Queue | Offline Queue |
22
+ |---------|-----------|-----------|----------------|---------------|
23
+ | **WSE** | **1.1M msg/s** | AES-256-GCM | Yes (5-level) | Yes (IndexedDB) |
24
+ | ws (Node) | ~50K msg/s | No | No | No |
25
+ | Socket.IO | ~25K msg/s | No | No | No |
26
+ | SSE | ~10K msg/s | No | No | No |
27
+
28
+ See [benchmarks/](benchmarks/) and [docs/BENCHMARKS.md](docs/BENCHMARKS.md) for methodology.
29
+
30
+ ---
31
+
32
+ ## Installation
33
+
34
+ ```bash
35
+ # Server (Python) — includes prebuilt Rust engine
36
+ pip install wse-server
37
+
38
+ # Client (React/TypeScript)
39
+ npm install wse-client
40
+ ```
41
+
42
+ Prebuilt wheels for Linux (x86_64, aarch64), macOS (x86_64, arm64), and Windows (x86_64).
43
+ Python 3.12+ (ABI3 stable — one wheel per platform).
44
+
45
+ ---
46
+
47
+ ## Features
48
+
49
+ **Rust-Accelerated Engine**
50
+ - Compression (zlib via flate2), sequencing, filtering, rate limiting — all in Rust
51
+ - PyO3 native module — no subprocess, no FFI overhead
52
+ - Python API unchanged — drop-in acceleration
53
+
54
+ **Security**
55
+ - End-to-end AES-256-GCM encryption per channel
56
+ - HMAC-SHA256 message signing
57
+ - JWT authentication with configurable claims
58
+ - Per-connection scope enforcement
59
+
60
+ **Reliability**
61
+ - Automatic reconnection with exponential backoff + jitter
62
+ - Sequence numbers with gap detection and out-of-order buffering
63
+ - Circuit breaker with configurable threshold
64
+ - Offline queue with IndexedDB persistence
65
+ - Connection health monitoring with adaptive quality
66
+
67
+ **Scaling**
68
+ - Redis pub/sub for multi-process fan-out
69
+ - Horizontal scaling across workers with shared state
70
+ - Per-topic subscription — clients receive only what they need
71
+
72
+ **Developer Experience**
73
+ - 4-line server setup with FastAPI
74
+ - React hook with full TypeScript types
75
+ - Zustand store integration
76
+ - Protocol versioning (v2) for backward compatibility
77
+
78
+ ---
79
+
80
+ ## Quick Start
81
+
82
+ ### Server (Python)
83
+
84
+ ```python
85
+ from fastapi import FastAPI
86
+ from wse_server import create_wse_router, WSEConfig
87
+
88
+ app = FastAPI()
89
+
90
+ wse = create_wse_router(WSEConfig(
91
+ redis_url="redis://localhost:6379",
92
+ encryption_key="your-32-byte-key-here...",
93
+ ))
94
+
95
+ app.include_router(wse, prefix="/wse")
96
+ ```
97
+
98
+ Publish from anywhere:
99
+
100
+ ```python
101
+ await wse.publish("prices", {"symbol": "AAPL", "price": 187.42})
102
+ ```
103
+
104
+ ### Client (React)
105
+
106
+ ```typescript
107
+ import { useWSE } from 'wse-client';
108
+
109
+ function PriceDisplay() {
110
+ const wse = useWSE(authToken, ['prices'], {
111
+ endpoints: ['ws://localhost:8000/wse'],
112
+ });
113
+
114
+ useEffect(() => {
115
+ const handler = (e: CustomEvent) => {
116
+ console.log('Price update:', e.detail);
117
+ };
118
+ window.addEventListener('price_update', handler);
119
+ return () => window.removeEventListener('price_update', handler);
120
+ }, []);
121
+
122
+ return <div>Status: {wse.connectionHealth}</div>;
123
+ }
124
+ ```
125
+
126
+ ---
127
+
128
+ ## Architecture
129
+
130
+ ```
131
+ Client (React/TypeScript) Server (Python + Rust)
132
+ --------------------- ---------------------
133
+
134
+ useWSE hook FastAPI Router
135
+ | |
136
+ v v
137
+ ConnectionManager Rust WSE Server
138
+ | |
139
+ v v
140
+ MessageProcessor EventTransformer (Rust)
141
+ | |
142
+ v v
143
+ Zustand Store PubSub Bus
144
+ | |
145
+ v v
146
+ React Components Redis Streams (optional)
147
+ ```
148
+
149
+ **Wire format (v2):**
150
+
151
+ ```json
152
+ {
153
+ "v": 2,
154
+ "id": "019503a1-...",
155
+ "t": "price_update",
156
+ "ts": "2026-01-15T10:30:00Z",
157
+ "seq": 42,
158
+ "p": { "symbol": "AAPL", "price": 187.42 }
159
+ }
160
+ ```
161
+
162
+ Category prefixes on the wire: `WSE{` (system), `S{` (snapshot), `U{` (update).
163
+
164
+ ---
165
+
166
+ ## Packages
167
+
168
+ | Package | Registry | Language | Install |
169
+ |---------|----------|----------|---------|
170
+ | `wse-server` | PyPI | Python + Rust | `pip install wse-server` |
171
+ | `wse-client` | npm | TypeScript + React | `npm install wse-client` |
172
+
173
+ Both packages are standalone — no shared dependencies between server and client.
174
+
175
+ ---
176
+
177
+ ## When NOT to Use WSE
178
+
179
+ | Use case | Better tool | Why |
180
+ |----------|-------------|-----|
181
+ | Simple chat rooms | Socket.IO | Built-in rooms, namespaces, broadcast |
182
+ | Service-to-service RPC | gRPC | Schema enforcement, bidirectional streaming |
183
+ | Message queues | RabbitMQ, Kafka | Persistent queues, consumer groups |
184
+ | Static dashboards | SSE | Simpler protocol, no WebSocket overhead |
185
+ | File uploads | HTTP multipart | WebSocket not designed for large binaries |
186
+
187
+ WSE is for: real-time UI updates, live data feeds, monitoring dashboards, collaborative state sync, and high-throughput server-to-client event delivery.
188
+
189
+ ---
190
+
191
+ ## Documentation
192
+
193
+ | Document | Description |
194
+ |----------|-------------|
195
+ | [Protocol Spec](docs/PROTOCOL.md) | Wire format, versioning, encryption |
196
+ | [Architecture](docs/ARCHITECTURE.md) | System design, data flow |
197
+ | [Benchmarks](docs/BENCHMARKS.md) | Methodology, results, comparisons |
198
+ | [Security Model](docs/SECURITY.md) | Encryption, auth, threat model |
199
+ | [Integration Guide](docs/INTEGRATION.md) | FastAPI setup, Redis, deployment |
200
+
201
+ ---
202
+
203
+ ## Technology Stack
204
+
205
+ | Component | Technology | Purpose |
206
+ |-----------|-----------|---------|
207
+ | Rust engine | PyO3 + maturin | Compression, sequencing, filtering, rate limiting |
208
+ | Server framework | FastAPI + Starlette | ASGI WebSocket handling |
209
+ | Serialization | orjson (Rust) | Zero-copy JSON |
210
+ | Binary protocol | msgpack (rmp-serde) | 30% smaller payloads |
211
+ | Encryption | AES-256-GCM (Rust) | Per-channel E2E encryption |
212
+ | Authentication | PyJWT | Token verification |
213
+ | Pub/Sub backbone | Redis Streams | Multi-process fan-out, replay |
214
+ | Client state | Zustand | Lightweight React store |
215
+ | Client hooks | React 18+ | useWSE hook |
216
+ | Build system | maturin | Rust+Python hybrid wheels |
217
+
218
+ ---
219
+
220
+ ## License
221
+
222
+ MIT
@@ -0,0 +1,195 @@
1
+ export declare const WS_PROTOCOL_VERSION = 2;
2
+ export declare const WS_CLIENT_VERSION = "1.0.0";
3
+ export declare const HEARTBEAT_INTERVAL = 15000;
4
+ export declare const IDLE_TIMEOUT = 40000;
5
+ export declare const CONNECTION_TIMEOUT = 10000;
6
+ export declare const HEALTH_CHECK_INTERVAL = 30000;
7
+ export declare const METRICS_INTERVAL = 60000;
8
+ export declare const RECONNECT_BASE_DELAY = 1000;
9
+ export declare const RECONNECT_MAX_DELAY = 30000;
10
+ export declare const RECONNECT_MAX_ATTEMPTS = -1;
11
+ export declare const RECONNECT_FACTOR = 1.5;
12
+ export declare const RECONNECT_JITTER = true;
13
+ export declare const CIRCUIT_BREAKER_THRESHOLD = 5;
14
+ export declare const CIRCUIT_BREAKER_TIMEOUT = 60000;
15
+ export declare const CIRCUIT_BREAKER_SUCCESS_THRESHOLD = 3;
16
+ export declare const MESSAGE_QUEUE_MAX_SIZE = 1000;
17
+ export declare const OFFLINE_QUEUE_MAX_SIZE = 1000;
18
+ export declare const BATCH_SIZE = 10;
19
+ export declare const BATCH_TIMEOUT = 100;
20
+ export declare const COMPRESSION_THRESHOLD = 1024;
21
+ export declare const COMPRESSION_LEVEL = 6;
22
+ export declare const RATE_LIMIT_CAPACITY = 1000;
23
+ export declare const RATE_LIMIT_REFILL_RATE = 100;
24
+ export declare const RATE_LIMIT_REFILL_INTERVAL = 1;
25
+ export declare const SEQUENCE_WINDOW_SIZE = 1000;
26
+ export declare const MAX_OUT_OF_ORDER = 100;
27
+ export declare const DUPLICATE_WINDOW_SIZE = 1000;
28
+ export declare const STORAGE_KEY_PREFIX = "wse_";
29
+ export declare const SUBSCRIPTION_STORAGE_KEY = "wse_subscriptions";
30
+ export declare const ENDPOINTS_STORAGE_KEY = "wse_endpoints";
31
+ export declare const METRICS_STORAGE_KEY = "wse_metrics";
32
+ export declare const DIAGNOSTICS_STORAGE_KEY = "wse_diagnostics";
33
+ export declare const DEFAULT_TOPICS: string[];
34
+ export declare const MESSAGE_HEADERS: {
35
+ readonly COMPRESSED: "C:";
36
+ readonly MSGPACK: "M:";
37
+ readonly ENCRYPTED: "E:";
38
+ };
39
+ export declare const MEMORY_LIMITS: {
40
+ readonly MAX_MESSAGE_SIZE: 1048576;
41
+ readonly MAX_QUEUE_MEMORY: number;
42
+ readonly MAX_HISTORY_SIZE: 1000;
43
+ readonly MAX_ERROR_HISTORY: 50;
44
+ };
45
+ export declare const FEATURES: {
46
+ readonly COMPRESSION: true;
47
+ readonly ENCRYPTION: false;
48
+ readonly BATCHING: true;
49
+ readonly PRIORITY_QUEUE: true;
50
+ readonly CIRCUIT_BREAKER: true;
51
+ readonly OFFLINE_QUEUE: true;
52
+ readonly MESSAGE_SIGNING: false;
53
+ readonly RATE_LIMITING: true;
54
+ readonly HEALTH_CHECK: true;
55
+ readonly METRICS: true;
56
+ };
57
+ export declare const INTERNAL_TO_WS_EVENT_TYPE_MAP: Record<string, string>;
58
+ export declare const ERROR_CODES: {
59
+ readonly NORMAL_CLOSURE: 1000;
60
+ readonly GOING_AWAY: 1001;
61
+ readonly PROTOCOL_ERROR: 1002;
62
+ readonly UNSUPPORTED_DATA: 1003;
63
+ readonly POLICY_VIOLATION: 1008;
64
+ readonly MESSAGE_TOO_BIG: 1009;
65
+ readonly SERVER_ERROR: 1011;
66
+ readonly AUTH_FAILED: 4401;
67
+ readonly AUTH_EXPIRED: 4403;
68
+ readonly RATE_LIMIT_EXCEEDED: 4429;
69
+ readonly SUBSCRIPTION_FAILED: 4430;
70
+ readonly INVALID_MESSAGE: 4400;
71
+ readonly SERVER_OVERLOAD: 4503;
72
+ };
73
+ export declare const PERFORMANCE_THRESHOLDS: {
74
+ readonly LATENCY: {
75
+ readonly EXCELLENT: 50;
76
+ readonly GOOD: 150;
77
+ readonly FAIR: 300;
78
+ };
79
+ readonly JITTER: {
80
+ readonly EXCELLENT: 25;
81
+ readonly GOOD: 50;
82
+ readonly FAIR: 100;
83
+ };
84
+ readonly PACKET_LOSS: {
85
+ readonly EXCELLENT: 0.1;
86
+ readonly GOOD: 1;
87
+ readonly FAIR: 3;
88
+ };
89
+ };
90
+ /**
91
+ * Get WebSocket endpoints. By default uses same-origin /wse path.
92
+ * Override this by providing endpoints in WSEConfig.
93
+ */
94
+ export declare function getEndpoints(): string[];
95
+ export declare function getSavedSubscriptions(): string[];
96
+ export declare function saveSubscriptions(topics: string[]): void;
97
+ export declare function clearWSEStorage(): void;
98
+ export declare const isValidPriority: (priority: number) => boolean;
99
+ export declare const isValidEventType: (type: string) => boolean;
100
+ export declare const isCompressedMessage: (data: ArrayBuffer) => boolean;
101
+ export declare const isMsgPackMessage: (data: ArrayBuffer) => boolean;
102
+ export declare const isEncryptedMessage: (data: ArrayBuffer) => boolean;
103
+ declare const _default: {
104
+ WS_PROTOCOL_VERSION: number;
105
+ WS_CLIENT_VERSION: string;
106
+ HEARTBEAT_INTERVAL: number;
107
+ IDLE_TIMEOUT: number;
108
+ CONNECTION_TIMEOUT: number;
109
+ HEALTH_CHECK_INTERVAL: number;
110
+ METRICS_INTERVAL: number;
111
+ RECONNECT_BASE_DELAY: number;
112
+ RECONNECT_MAX_DELAY: number;
113
+ RECONNECT_MAX_ATTEMPTS: number;
114
+ RECONNECT_FACTOR: number;
115
+ RECONNECT_JITTER: boolean;
116
+ CIRCUIT_BREAKER_THRESHOLD: number;
117
+ CIRCUIT_BREAKER_TIMEOUT: number;
118
+ CIRCUIT_BREAKER_SUCCESS_THRESHOLD: number;
119
+ MESSAGE_QUEUE_MAX_SIZE: number;
120
+ OFFLINE_QUEUE_MAX_SIZE: number;
121
+ BATCH_SIZE: number;
122
+ BATCH_TIMEOUT: number;
123
+ COMPRESSION_THRESHOLD: number;
124
+ COMPRESSION_LEVEL: number;
125
+ RATE_LIMIT_CAPACITY: number;
126
+ RATE_LIMIT_REFILL_RATE: number;
127
+ RATE_LIMIT_REFILL_INTERVAL: number;
128
+ SEQUENCE_WINDOW_SIZE: number;
129
+ MAX_OUT_OF_ORDER: number;
130
+ DUPLICATE_WINDOW_SIZE: number;
131
+ STORAGE_KEY_PREFIX: string;
132
+ SUBSCRIPTION_STORAGE_KEY: string;
133
+ ENDPOINTS_STORAGE_KEY: string;
134
+ METRICS_STORAGE_KEY: string;
135
+ DIAGNOSTICS_STORAGE_KEY: string;
136
+ DEFAULT_TOPICS: string[];
137
+ INTERNAL_TO_WS_EVENT_TYPE_MAP: Record<string, string>;
138
+ ERROR_CODES: {
139
+ readonly NORMAL_CLOSURE: 1000;
140
+ readonly GOING_AWAY: 1001;
141
+ readonly PROTOCOL_ERROR: 1002;
142
+ readonly UNSUPPORTED_DATA: 1003;
143
+ readonly POLICY_VIOLATION: 1008;
144
+ readonly MESSAGE_TOO_BIG: 1009;
145
+ readonly SERVER_ERROR: 1011;
146
+ readonly AUTH_FAILED: 4401;
147
+ readonly AUTH_EXPIRED: 4403;
148
+ readonly RATE_LIMIT_EXCEEDED: 4429;
149
+ readonly SUBSCRIPTION_FAILED: 4430;
150
+ readonly INVALID_MESSAGE: 4400;
151
+ readonly SERVER_OVERLOAD: 4503;
152
+ };
153
+ MESSAGE_HEADERS: {
154
+ readonly COMPRESSED: "C:";
155
+ readonly MSGPACK: "M:";
156
+ readonly ENCRYPTED: "E:";
157
+ };
158
+ PERFORMANCE_THRESHOLDS: {
159
+ readonly LATENCY: {
160
+ readonly EXCELLENT: 50;
161
+ readonly GOOD: 150;
162
+ readonly FAIR: 300;
163
+ };
164
+ readonly JITTER: {
165
+ readonly EXCELLENT: 25;
166
+ readonly GOOD: 50;
167
+ readonly FAIR: 100;
168
+ };
169
+ readonly PACKET_LOSS: {
170
+ readonly EXCELLENT: 0.1;
171
+ readonly GOOD: 1;
172
+ readonly FAIR: 3;
173
+ };
174
+ };
175
+ MEMORY_LIMITS: {
176
+ readonly MAX_MESSAGE_SIZE: 1048576;
177
+ readonly MAX_QUEUE_MEMORY: number;
178
+ readonly MAX_HISTORY_SIZE: 1000;
179
+ readonly MAX_ERROR_HISTORY: 50;
180
+ };
181
+ FEATURES: {
182
+ readonly COMPRESSION: true;
183
+ readonly ENCRYPTION: false;
184
+ readonly BATCHING: true;
185
+ readonly PRIORITY_QUEUE: true;
186
+ readonly CIRCUIT_BREAKER: true;
187
+ readonly OFFLINE_QUEUE: true;
188
+ readonly MESSAGE_SIGNING: false;
189
+ readonly RATE_LIMITING: true;
190
+ readonly HEALTH_CHECK: true;
191
+ readonly METRICS: true;
192
+ };
193
+ };
194
+ export default _default;
195
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../client/constants.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,mBAAmB,IAAI,CAAC;AACrC,eAAO,MAAM,iBAAiB,UAAU,CAAC;AAMzC,eAAO,MAAM,kBAAkB,QAAQ,CAAC;AACxC,eAAO,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