feat(streaming): add real-time streaming (MongoDB change streams & S3 bucket watchers) with WebSocket subscriptions and activity stream UI
This commit is contained in:
@@ -53,3 +53,47 @@ typedrouter.addTypedHandler(
|
||||
)
|
||||
);
|
||||
```
|
||||
|
||||
## Real-Time Streaming (v1.5.0+)
|
||||
|
||||
### Architecture
|
||||
- `ts/streaming/` - Backend streaming infrastructure
|
||||
- `classes.changestream-manager.ts` - Manages MongoDB and S3 watchers
|
||||
- `interfaces.streaming.ts` - TypedRequest interfaces for subscriptions
|
||||
- `ts_web/services/changestream.service.ts` - Frontend WebSocket client
|
||||
|
||||
### MongoDB Change Streams
|
||||
- Uses native MongoDB Change Streams via `SmartdataDb.mongoDbClient`
|
||||
- Subscription per collection: `db/collection`
|
||||
- Events: insert, update, delete, replace, drop
|
||||
|
||||
### S3 Change Detection
|
||||
- Uses `@push.rocks/smartbucket` BucketWatcher (polling-based)
|
||||
- Polling interval: 5 seconds
|
||||
- Events: add, modify, delete
|
||||
|
||||
### Frontend Components
|
||||
- `tsview-activity-stream.ts` - Combined activity view with filtering
|
||||
- MongoDB/S3 browsers auto-subscribe to current resource
|
||||
- Visual indicators for "Live" status and recent change count
|
||||
|
||||
### Key Streaming Interfaces
|
||||
```typescript
|
||||
// Subscribe to collection changes
|
||||
IReq_SubscribeMongo: { database, collection } -> { success, subscriptionId }
|
||||
|
||||
// Subscribe to bucket changes
|
||||
IReq_SubscribeS3: { bucket, prefix? } -> { success, subscriptionId }
|
||||
|
||||
// Subscribe to activity stream (all changes)
|
||||
IReq_SubscribeActivity: {} -> { success, subscriptionId }
|
||||
|
||||
// Server pushes changes to subscribed clients
|
||||
IReq_PushMongoChange: { event: IMongoChangeEvent } -> { received }
|
||||
IReq_PushS3Change: { event: IS3ChangeEvent } -> { received }
|
||||
IReq_PushActivityEvent: { event: IActivityEvent } -> { received }
|
||||
```
|
||||
|
||||
### Dependencies Added
|
||||
- `@api.global/typedsocket` - WebSocket client/server
|
||||
- `@push.rocks/smartrx` - RxJS utilities
|
||||
|
||||
Reference in New Issue
Block a user