Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fastify-sse-v2

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastify-sse-v2 - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

9

CHANGELOG.md

@@ -9,2 +9,6 @@ # Changelog

## [2.0.2]
## Fixes
- headers not being set
## [2.0.1]

@@ -34,4 +38,5 @@ ## Bugfix

[Unreleased]: https://github.com/nodefactoryio/fastify-sse-v2/compare/v2.0.1...HEAD
[2.0.0]: https://github.com/nodefactoryio/fastify-sse-v2/compare/v2.0.0...v2.0.1
[Unreleased]: https://github.com/nodefactoryio/fastify-sse-v2/compare/v2.0.2...HEAD
[2.0.2]: https://github.com/nodefactoryio/fastify-sse-v2/compare/v2.0.1...v2.0.2
[2.0.1]: https://github.com/nodefactoryio/fastify-sse-v2/compare/v2.0.0...v2.0.1
[2.0.0]: https://github.com/nodefactoryio/fastify-sse-v2/compare/v1.0.4...v2.0.0

@@ -38,0 +43,0 @@ [1.0.4]: https://github.com/nodefactoryio/fastify-sse-v2/compare/v1.0.3...v1.0.4

@@ -16,8 +16,10 @@ "use strict";

instance.decorateReply("sse", function (source) {
const outputStream = this.raw;
outputStream.write((0, _sse.serializeSSEEvent)({
this.raw.setHeader("Content-Type", "text/event-stream");
this.raw.setHeader("Connection", "keep-alive");
this.raw.setHeader("Cache-Control", "no-cache,no-transform");
this.raw.setHeader("x-no-compression", 1);
this.raw.write((0, _sse.serializeSSEEvent)({
retry: options.retryDelay || 3000
}));
this.type("text/event-stream").header("Connection", "keep-alive").header("Cache-Control", "no-cache,no-transform").header("x-no-compression", true);
(0, _itToStream.default)((0, _sse.transformAsyncIterable)(source)).pipe(outputStream);
(0, _itToStream.default)((0, _sse.transformAsyncIterable)(source)).pipe(this.raw);
});

@@ -24,0 +26,0 @@ };

{
"name": "fastify-sse-v2",
"version": "2.0.1",
"version": "2.0.2",
"description": "Fastify plugin for sending server side events.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

import {EventMessage, FastifyPluginAsync, FastifyReply} from "fastify";
import {SsePluginOptions} from "./types";
import {Writable} from "stream";
import {serializeSSEEvent, transformAsyncIterable} from "./sse";

@@ -12,10 +11,9 @@ import toStream from "it-to-stream";

function (this: FastifyReply, source: AsyncIterable<EventMessage>): void {
const outputStream: Writable = this.raw;
outputStream.write(serializeSSEEvent({retry: options.retryDelay || 3000}));
this.type("text/event-stream")
.header("Connection", "keep-alive")
.header("Cache-Control", "no-cache,no-transform")
.header("x-no-compression", true);
toStream(transformAsyncIterable(source)).pipe(outputStream);
this.raw.setHeader("Content-Type","text/event-stream");
this.raw.setHeader("Connection", "keep-alive");
this.raw.setHeader("Cache-Control", "no-cache,no-transform");
this.raw.setHeader("x-no-compression", 1);
this.raw.write(serializeSSEEvent({retry: options.retryDelay || 3000}));
toStream(transformAsyncIterable(source)).pipe(this.raw);
});
};

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc