Add per-adapter architecture docs in event-targets/ directory
- Create docs/architecture/event-targets/ with individual specs: in-process, redis, websocket-client, websocket-server, worker, iroh-spoke, iroh-hub - Update event-targets.md to serve as index with topology model (symmetric vs fan-out) and adapter status table - Update architecture.md index to reference new directory
This commit is contained in:
25
docs/architecture/event-targets/in-process.md
Normal file
25
docs/architecture/event-targets/in-process.md
Normal file
@@ -0,0 +1,25 @@
|
||||
---
|
||||
status: draft
|
||||
last_updated: 2026-05-07
|
||||
---
|
||||
|
||||
# In-Process Event Target
|
||||
|
||||
No adapter needed. `createPubSub` uses `new EventTarget()` by default.
|
||||
|
||||
This works for single-process deployments where all pubsub participants share the same memory. The web standard `EventTarget` already implements `addEventListener`/`dispatchEvent`/`removeEventListener`.
|
||||
|
||||
```ts
|
||||
const pubsub = createPubSub<MyEventMap>();
|
||||
// uses new EventTarget() by default
|
||||
```
|
||||
|
||||
Could be formalized as an explicit `InProcessEventTarget` for documentation purposes, but there's no functional need — the browser/Node `EventTarget` is the reference implementation of the `TypedEventTarget` contract.
|
||||
|
||||
## Design Notes
|
||||
|
||||
- Topics use the `type:id` string convention (e.g., `"call.responded:uuid-123"`)
|
||||
- `CustomEvent.detail` carries the full `EventEnvelope` object
|
||||
- No serialization — objects are passed by reference
|
||||
- Synchronous dispatch — listeners fire immediately in the current call stack
|
||||
- No connection lifecycle, no reconnection concerns
|
||||
Reference in New Issue
Block a user