22 lines
961 B
Markdown
22 lines
961 B
Markdown
# TypedSocket Hints
|
|
|
|
## SmartServe Integration (Added v3.1.0)
|
|
|
|
TypedSocket now supports SmartServe as an alternative WebSocket backend via `TypedSocket.fromSmartServe()`.
|
|
|
|
### Key Differences from Smartsocket Mode
|
|
|
|
1. **Tag System**: SmartServe uses `Set<string>` for tags, while Smartsocket uses `{id, payload}`. The wrapper stores payloads in `peer.data` with `__typedsocket_tag__` prefix.
|
|
|
|
2. **Request/Response**: Uses TypedRouter's `fireEventInterestMap` for async correlation when sending server-initiated requests.
|
|
|
|
3. **Lifecycle**: SmartServe manages WebSocket lifecycle. `typedSocket.stop()` only clears internal state.
|
|
|
|
4. **eventSubject**: Not fully supported in SmartServe mode - use SmartServe's `onConnectionOpen`/`onConnectionClose` hooks instead.
|
|
|
|
### Files Modified for SmartServe Support
|
|
|
|
- `ts/typedsocket.classes.typedsocket.ts` - Main implementation
|
|
- `ts/typedsocket.plugins.ts` - Type imports
|
|
- `package.json` - Optional peer dependency
|