GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - EventSource/node-ssestream: Send Server-Sent Events with a stream

BranchesTags
Open more actions menu

Latest commit

 

History

8 Commits
8 Commits

Folders and files

NameName
Last commit message
Last commit date
test
test
 
 
.gitignore
.gitignore
 
 
.mocharc.json
.mocharc.json
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
index.ts
index.ts
 
 
package.json
package.json
 
 
tsconfig.json
tsconfig.json
 
 

Repository files navigation

SseStream

A zero-dependency node stream for writing Server-Sent Events.

Installation

npm install ssestream

Or:

yarn add ssestream

Usage

In a (req, res) handler for a request event, Express #get route or similar:

const SseStream = require('ssestream')

function (req, res) {
  const sse = new SseStream(req)
  sse.pipe(res)
  
  const message = {
    data: 'hello\nworld',
  }
  sse.write(message)
}

Properties on message:

  • data - String or object, which gets turned into JSON
  • event - (optional) String
  • id - (optional) String
  • retry - (optional) number
  • comment - (optional) String

TypeScript

The SseStream#writeMessage(message) method is a type-safe alias for SseStream#write(message).

About

Send Server-Sent Events with a stream

Resources

Readme
MIT license

Contributing

Contributing
Activity
Custom properties

Stars

46 stars

Watchers

4 watching

Forks

8 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.