npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

thread-sse

v1.0.4

Published

Thread-SSE is a library for Node.js and web browsers to develop security and high-performance SSE (Server-Send-Events) applications.

Downloads

15

Readme

Thread-SSE


Thread-SSE is a library for Node.js and web browsers to develop security and high-performance SSE (Server-Send-Events) applications.

Features


  • Based on Node.js built-in modules, supports HTTP, HTTPS, and HTTP/2 protocols, being compatible with most web browsers, faster real-time communication.

  • One SSE server-side only connects one Thread-SSE client, and one web browser has one Thread-SSE connection.

  • Validates SSE data at the time of data sending and data receiving.

  • Thread-SSE data includes a data id and data with defined types, the developer can create client actions to an SSE data or directly using system default client actions.

  • The members of the user group can send and receive data via SSE.

  • Thread-SSE is extendable and customizable.

Installation of Thread-SSE package and environment


Runs the following commands from the directory of your project.

1. Installs Thread-SSE

npm install thread-sse

2. Installs Thread-SSE environment

node ./node_modules/thread-sse/postinstall

Using examples


// Responds Thread-SSE client library
libStyleGraph(request, response, "/public/js/tsse.js");

// Responds custom client library
libStyleGraph(request, response, "/public/js/custom-tsse.js");

// Responds the Thread-SSE client 
responseClient(request, response, content);

// Handles Thread-SSE connection request
setTsseConnection(request, response);

// Starts Thread-SSE server for the specific client
tsseServer(tsseServicePath, response);

// Sends a Thread-SSE data
updateTsseData(tsseServicePath, tsseUser, "1000", "Sending Thread SSE Data");     

// Sends a custom Thread-SSE data
updateTsseData(tsseServicePath, tsseUser, "4050", "Joanne Whalley", "(647) 823-7580");

// Sends shared Thread-SSE data to members of the group
updateGroupTsseData(request, response, members);

Tests


Runs the test server:

node ./node_modules/thread-sse/test/server

Then runs testing with http://localhost:3000/test/index.html from web browsers.

Demo applications


postinstall.js installed Thread-SSE demo applications in the folder of Thread-SSE project, the demo applications include:

server-http.js

The example application of Thread-SSE server over HTTP protocol.

cluster-server-http.js

The example application that clusters Thread-SSE server over HTTP protocol to take advantage of multi-core systems.

server-https.js

The example application of Thread-SSE server over HTTPS protocol.

server-http2.js

The example application of Thread-SSE server over HTTP/2 protocol.

server-express.js

The example application of Thread-SSE server with Express over HTTP protocol.

server-express-https.js

The example application of Thread-SSE server with Express over HTTPS protocol.

Starts demo Thread-SSE server then access the application from http://localhost:3000/client.html

Developing Thread-SSE application


Develops the access control to Thread-SSE data

Overrides methods of AccessControl class from ./custom/access-control.js, managing users and user group with the authentication used by your project.

Creates custom validation

Creates custom validation for server-side data sending from ./custom/validation.js and the data receiving of the web browsers from ./js/custom-tsse.js if you defined custom data to your project.

Writes client actions

Writes your client actions in the function tsseAction(id, dt, bulk, tag) from ./js/custom-tsse.js, the arguments of tsseAction are data sent by Thread-SSE server.

Sends shared data

Sends shared data with sendSharedTsseData and assigns it as a browser event handler in ./js/custom-tsse.js

Updates SSL/TLS certificate and private key files

Updates SSL/TLS certificate and private key files in ./custom folder for the product of your project.

Documentation


To see Thread-SSE documentation

License


MIT