Skip to content

v2.4.0

Latest
Compare
Choose a tag to compare
@toverux toverux released this 12 Feb 22:43
· 2 commits to master since this release

2.4.0 (2018-02-12)

Features

  • sse_handler_middleware: add flushHeaders option, and use proper headers flushing technique (918bacf)
export interface ISseMiddlewareOptions {
    // ...

    /**
     * Whether to flush headers immediately or wait for the first res.write().
     *  - Setting it to false can allow you or 3rd-party middlewares to set more headers on the response.
     *  - Setting it to true is useful for debug and tesing the connection, ie. CORS restrictions fail only when headers
     *    are flushed, which may not happen immediately when using SSE (it happens after the first res.write call).
     *
     * @default true
     */
    flushHeaders: boolean;

    // ...
  • sse_handler_middleware: heartbeats can now be disabled (dd5a628)
export interface ISseMiddlewareOptions {
    /**
     * Determines the interval, in milliseconds, between keep-alive packets (neutral SSE comments).
+     * Pass false to disable heartbeats (ie. you only support modern browsers/native EventSource implementation and
+     * therefore don't need heartbeats to avoid the browser closing an inactive socket).
     *
     * @default 5000
     */
-    keepAliveInterval: number;
+    keepAliveInterval: false | number;