1.0.3 • Published 1 year ago
websocket-self v1.0.3
Websocket with external server
realtime with node js
Features
- send spesific user with websocket
- limit 1 million message/day
Installation
requires Node.js v16+ to run.
Install the dependencies and devDependencies and start the server.
yarn add websocket-self
or
npm install websocket-self
Usage
Usage Package Socket Ryan for server
socket server this
import express from "express";
import Socket from "websocket-self";
let aws = Socket.init("ws://127.0.0.1:9999"); //url from socket server
let app = express();
aws.socket.onmessage = (data) => {
console.log(data);
};
app.get("/socket", (req, res) => {
aws.send("spesific token", "message");
return res.send({
api: true,
});
});
app.listen(3333, "0.0.0.0", () => {
console.log("Connect to port 3333");
});
License
MIT
Free Software, Hell Yeah!