In cases, such as when providing GraphQL subscriptions, you want to be notified when events matching certain criteria are committed to the store.
You accomplish this by using the EventStreamer and EventSubscriber classes provided by the @ddes/event-streaming
package.
Installation
yarn add @ddes/event-streaming |
Running server
EventStreamer provides push-style event subscriptions over WebSockets.
import {EventStreamer} from '@ddes/event-streaming' |
Subscribing to events
EventSubscriber connects to an EventStreamer and yields matching events as they are committed to the store.
import {EventSubscriber} from '@ddes/event-streaming' |