MatthewWid / better-sse

⬆ Dead simple, dependency-less, spec-compliant server-sent events implementation for Node, written in TypeScript.
https://matthewwid.github.io/better-sse/
MIT License
558 stars 14 forks source link

Channel performance improvements #34

Closed MatthewWid closed 2 years ago

MatthewWid commented 2 years ago

This MR improves performance when using channels by implementing the underlying session list with a Set instead of an array.

In addition, it updates the register and deregister methods to short-circuit if the session is already registered or deregistered, respectively and updates the automatic session deregistration to fire the session-disconnected event before the event is deregistered instead of after.