1.0.3 • Published 1 year ago

websocket-self v1.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

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!

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago