TREEcg / event-stream-client

Deprecated! Use the rdf-connect/ldes-client instead
https://github.com/rdf-connect/ldes-client
Other
14 stars 9 forks source link

EventStream - add Pause and State methods #36

Closed KasperZutterman closed 2 years ago

KasperZutterman commented 2 years ago

To stop receiving new data event members midway, it should be possible to stop the EventStream. To enable this there should be the addition of the following methods:

These are needed to allow this general flow:

let stream = LDESClient.createReadStream();
stream.on("data", ...);
...
stream.pause();
let previousState = stream.exportState();

// In another run
let stream = LDESClient.createReadStream(previousState);
stream.on("data", ...);