rexxars / sse-channel

Server-Sent Events "channel" where all messages are broadcasted to all connected clients, history is maintained automatically and server attempts to keep clients alive by sending "keep-alive" packets automatically.
MIT License
111 stars 11 forks source link

Option for flushing after each write #5

Closed rexxars closed 9 years ago

rexxars commented 9 years ago

The compression middleware for express (and probably others as well) causes some issues with the library, since it'll wait for a certain amount of data before sending it downstream. Documented here.

Adding an option that would enable explicit flushing after each write would be a good thing, along with documenting both the option and the problem in the README.

rexxars commented 9 years ago

Solved in 4f00f4fab255826d0520f2baedfbcd75f765c3c0 and released as 1.0.6. I didn't see any reason to use an option for this - it seemed like the reasonable thing to do, so it simply checks if the flush method exists on the response and calls it after a write.