mirror of
https://github.com/xtr-dev/rondevu-client.git
synced 2025-12-10 02:43:25 +00:00
feat: v0.9.0 - durable WebRTC connections with automatic reconnection
Major refactor replacing low-level APIs with high-level durable connections.
New Features:
- Automatic reconnection with exponential backoff (1s → 2s → 4s → ... max 30s)
- Message queuing during disconnections
- Durable channels that survive connection drops
- TTL auto-refresh for services (refreshes at 80% of TTL by default)
- Full configuration of timeouts, retry limits, and queue sizes
New API:
- client.exposeService() - Create durable service with automatic TTL refresh
- client.connect() - Create durable connection with automatic reconnection
- client.connectByUuid() - Connect by service UUID
- DurableChannel - Event-based channel wrapper with message queuing
- DurableConnection - Connection manager with reconnection logic
- DurableService - Service manager with TTL auto-refresh
Files Added:
- src/durable/types.ts - Type definitions and enums
- src/durable/reconnection.ts - Exponential backoff utilities
- src/durable/channel.ts - DurableChannel class (358 lines)
- src/durable/connection.ts - DurableConnection class (441 lines)
- src/durable/service.ts - DurableService class (329 lines)
- MIGRATION.md - Comprehensive migration guide
Files Removed:
- src/services.ts - Replaced by DurableService
- src/discovery.ts - Replaced by DurableConnection
BREAKING CHANGES:
- Removed: client.services.*, client.discovery.*, client.createPeer()
- Added: client.exposeService(), client.connect(), client.connectByUuid()
- Handler signature: (channel, peer, connectionId?) → (channel, connectionId)
- Event handlers: .onmessage → .on('message')
- Services: Must call service.start() to begin accepting connections
- Connections: Must call connection.connect() to establish connection
This commit is contained in:
54
src/index.ts
54
src/index.ts
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @xtr-dev/rondevu-client
|
||||
* WebRTC peer signaling and discovery client with topic-based discovery
|
||||
* WebRTC peer signaling and discovery client with durable connections
|
||||
*/
|
||||
|
||||
// Export main client class
|
||||
@@ -11,44 +11,26 @@ export type { RondevuOptions } from './rondevu.js';
|
||||
export { RondevuAuth } from './auth.js';
|
||||
export type { Credentials, FetchFunction } from './auth.js';
|
||||
|
||||
// Export offers API
|
||||
export { RondevuOffers } from './offers.js';
|
||||
export type {
|
||||
CreateOfferRequest,
|
||||
Offer,
|
||||
IceCandidate,
|
||||
TopicInfo
|
||||
} from './offers.js';
|
||||
|
||||
// Export peer manager
|
||||
export { default as RondevuPeer } from './peer/index.js';
|
||||
export type {
|
||||
PeerOptions,
|
||||
PeerEvents,
|
||||
PeerTimeouts
|
||||
} from './peer/index.js';
|
||||
|
||||
// Export username API
|
||||
export { RondevuUsername } from './usernames.js';
|
||||
export type { UsernameClaimResult, UsernameCheckResult } from './usernames.js';
|
||||
|
||||
// Export services API
|
||||
export { RondevuServices } from './services.js';
|
||||
export type {
|
||||
ServicePublishResult,
|
||||
PublishServiceOptions,
|
||||
ServiceHandle
|
||||
} from './services.js';
|
||||
// Export durable connection APIs
|
||||
export { DurableConnection } from './durable/connection.js';
|
||||
export { DurableChannel } from './durable/channel.js';
|
||||
export { DurableService } from './durable/service.js';
|
||||
|
||||
// Export discovery API
|
||||
export { RondevuDiscovery } from './discovery.js';
|
||||
// Export durable connection types
|
||||
export type {
|
||||
ServiceInfo,
|
||||
ServiceListResult,
|
||||
ServiceQueryResult,
|
||||
ServiceDetails,
|
||||
ConnectResult
|
||||
} from './discovery.js';
|
||||
|
||||
// Export pool types
|
||||
export type { PoolStatus, PooledServiceHandle } from './service-pool.js';
|
||||
DurableConnectionState,
|
||||
DurableChannelState,
|
||||
DurableConnectionConfig,
|
||||
DurableChannelConfig,
|
||||
DurableServiceConfig,
|
||||
QueuedMessage,
|
||||
DurableConnectionEvents,
|
||||
DurableChannelEvents,
|
||||
DurableServiceEvents,
|
||||
ConnectionInfo,
|
||||
ServiceInfo
|
||||
} from './durable/types.js';
|
||||
|
||||
Reference in New Issue
Block a user