ssestream
- Version 1.1.0
- Published
- 22.2 kB
- No dependencies
- MIT license
Install
npm i ssestream
yarn add ssestream
pnpm add ssestream
Overview
Send Server-Sent Events with a stream
Index
Classes
Type Aliases
Classes
class SseStream
class SseStream extends Transform {}
Transforms "messages" to W3C event stream content. See https://html.spec.whatwg.org/multipage/server-sent-events.html A message is an object with one or more of the following properties: - data (String or object, which gets turned into JSON) - event - id - retry - comment
If constructed with a HTTP Request, it will optimise the socket for streaming. If this stream is piped to an HTTP Response, it will set appropriate headers.
constructor
constructor(req?: IncomingMessage);
method pipe
pipe: <T extends unknown>(destination: T, options?: { end?: boolean }) => T;
method writeMessage
writeMessage: ( message: Message, encoding?: string, cb?: (error: Error | null | undefined) => void) => boolean;
Type Aliases
type HeaderStream
type HeaderStream = NodeJS.WritableStream & WriteHeaders;
Package Files (1)
Dependencies (0)
No dependencies.
Dev Dependencies (7)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/ssestream
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/ssestream)
- HTML<a href="https://www.jsdocs.io/package/ssestream"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 1007 ms. - Missing or incorrect documentation? Open an issue for this package.