I'm getting really happy with the abstractions for keeping the client up to date with new data.
I call them projections. On the server, a projection has a schema
, a processor
and a channel
.
The schema
knows what is persisted about the projection in the database. The processor
knows how to populate the database from the domain events, and broadcasts messages to clients when appropriate. The channel
handles the connection to clients, including authorization and DTOs.
It's now really ease to use in the client:
const [oase] = useProjection(`feel:oase:${oaseId}`);
Now just use oase
, and trust it will be updated real-time whenever something happens.