Skip to content

local-projects/node-eventsource-http2

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Local Projects node-eventsource-http2 Fork

Overview

Forked from capturetechnologies/node-eventsource-http2 with modifications merged from bobheadlabs/node-eventsource-http2.

Modifications

Modified to implement a few missing constructor options from the eventsource package on which this library was modeled:

Additional constructor option parameters include:

  • ca: string | Buffer | Array<string | Buffer> | undefined;
    Pass a certificate to optionally override the trusted CA certificates.

    Example:

    // Specify a trusted certificate authority
    const sse = new EventSource('https://example.com', { ca: fs.readFileSync("./ca.crt") });
  • rejectUnauthorized: boolean
    Allow connections even with an invalid certificate . The HTTP2 documentation asserts that this option only applies to servers, but testing indicates that it has an affect on clients as well. This is unsafe and should not be used in production (or possibly ever).

    Example:

    // Connects to servers with self-signed certificates, unsafe in production
    const sse = new EventSource('https://example.com', { rejectUnathorized: false });

Original Readme:

why

Eventsource nodejs client https://github.com/EventSource/eventsource doesn't support http/2.

This package fixes it build on top of http2, so it fully supports it

install

npm install node-eventsource-http2

usage

Spec

const EventSource = require('node-eventsource')
const sse = new EventSource('your.endpoint/sse');
sse.addEventListener('type', (event) => {
  // your code goes here
})

About

Nodejs EventSource implementation with http2 support

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 52.2%
  • TypeScript 47.8%