Gathering detailed insights and metrics for easy-chat-pushjs
Gathering detailed insights and metrics for easy-chat-pushjs
Gathering detailed insights and metrics for easy-chat-pushjs
Gathering detailed insights and metrics for easy-chat-pushjs
Push Notifications using WebSocket, supports android, IOS and browser background notifications (FCM) and Slack notifications.
npm install easy-chat-pushjs
Typescript
Module System
Node Version
NPM Version
TypeScript (70.79%)
JavaScript (28.82%)
Shell (0.39%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
4 Stars
85 Commits
1 Forks
1 Watchers
6 Branches
1 Contributors
Updated on Jan 23, 2023
Latest Version
3.9.4
Package Id
easy-chat-pushjs@3.9.4
Unpacked Size
169.83 kB
Size
49.92 kB
File Count
39
NPM Version
9.6.7
Node Version
18.17.0
Published on
Mar 28, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Get your advanced chat and pushjs server ready in minutes
npm install --save easy-chat-pushjs
$ git clone https://github.com/AdamSEY/easy-chat-pushjs && cd easy-chat-pushjs/docker
Create your RS256 private and public keys used for JWT authentication between the server and the client. We only need the public key for the server. You will need the private key to create JWT tokens for authentication.
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key && openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
Docker-compose.yaml edits If you want to use firebase cloud messaging notifications, add firebaseApiKey while starting the server. If your application (client) will be on a different server other than the websocket server, let ZMQ listen to 0.0.0.0:3500 (check docker-compose.yaml file). if you're doing so, make sure to restrict connections to your server to only the IP address of the client.
now you're ready to start the server
sudo docker-compose up -d
Create RS256 key pairs on Unix-like OS
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key && openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
const {User} = require('easy-chat-pushjs');
const path = require('path');
const user = new User({
version: 1.0,
jwtPrivateKey: path.dirname(__dirname) + '/private.key',
zmqClientAddress: 'tcp://server_zmq_address:3500,tcp://server_zmq_address2:3500',
// you can publish to multiple websocket servers at once. add your servers ZMQ servers addresses separated by comma.
// if the Websocket Server is installed on this server, you can use 127.0.0.1:3500 or remove the line.
});
// version: used to invalidate the old tokens (must match the server version)
// jwtPrivateKey: absoulte path to the jwt private key, used to encrypt the token.
// slackURL: If you want to push notifications to slack (optional)
const token = user.createUserToken([ARRAY_OF_ROOMS] ,"<PUBLISH_ROOM>" , '<USER_ID>', "<UNIQUE_ID>");
// ARRAY_OF_ROOMS: (optional) array of rooms
// CHAT_ROOM: (optional) users can publish via socket.io frontend-side only to this channel.
// USER_ID: (optional) used to push notifications to a speicifc user.
// UNIQUE_ID: (optional) used to disallow multiple connections could be a user IP e.g. 188.22.34.33
TIP: Check examples/client for more information about using this token
Once your clients are connected to your websocket server, you're good to start pushing notifications
Make sure redis is up and running, in terminal type: sudo service redis start
create your jwt RS256 key pairs and set the path in the options object.
create your server.js
file (see examples/websocket.js)
Run your server.js
by calling node server.js
Now we assume your clients have connected to the websocket server and they're ready to receive socket messages.
if you'd like to push a message to all the clients who are connected to 'gender' you do the following
const {User} = require('easy-chat-pushjs');
const path = require('path');
const user = new User({
version: 1.0,
jwtPrivateKey: path.dirname(__dirname) + '/private.key',
slackURL: "https://hooks.slack.com/services/EXAMPLE/....",
});
user.pushNotification('gender', {message: 'hello there'}).then(() => {console.log("Message Pushed")});
Send a message to a specific user based on token's userId.
user.pushNotification(null, {message: hello} , '<USER_ID>').then(() => {console.log("Message Pushed")});;
push a firebase notification, take a look at the following link if you want to know how to get a browser token.
user.pushFirebaseNotifications(['FCM_TOKEN'], 'test', 'You have received a new request' ).then(() => {console.log("Firebase Message Pushed")});;
push slack notification, you need a webhook url to be set while configuring the server, for more information click here
user.pushSlackMessage('You have received a new request').then(() => {console.log("Slack Message Pushed")});;
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream socketio {
server 127.0.0.1:5511;
}
Server{
location ^~ /websocket/ {
proxy_pass http://socketio;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 86400;
// if over loadbalancer or cloudflare
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Take a look on the examples' directory, you'll find there:
websocket.js
client.js
push.js
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
29 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-14
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More