MatthewWid / better-sse

⬆ Dead simple, dependency-less, spec-compliant server-sent events implementation for Node, written in TypeScript.
MIT License
485 stars 14 forks source link

Allow passing different session "states" per channel #49

Closed flipace closed 1 year ago

flipace commented 1 year ago

When using different types of sessions, with different states, it's useful to be able to specify the state type of sessions inside a channel (instead of overwriting / extending the interface).

This change allows to pass the session state type in addition to the channel state:

const channel = createChannel<any, { flag: boolean }>();
MatthewWid commented 1 year ago

Thanks so much for contributing! This will be included in the next release.