- 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
25 lines
1010 B
Markdown
25 lines
1010 B
Markdown
---
|
|
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 |