0.0.775 • Published 5 years ago
lcnet v0.0.775
lcnet
Network handler for Javascript and NodeJS Install
npm i --save lcnet
How to use
- With SocketIO
const LCSocketIO = require("lcnet").SocketIO; const HOST_IP = "127.0.0.1"; const PORT = 8000; let io = new LCSocketIO(); // start the connection and start listening to some events io.connect(HOST_IP, PORT); io.addListener("connect", () => console.log("conncted!")); io.addListener("disconnect", () => console.log("disconnected!")); io.addListener("message", (data) => { console.log("receive >", data); } // send an object with the specific type io.send("message", {type:"json object"}); // disconnect from socket io.close();
- With UDP
```js
const {UDP} = require("lcnet");
const RECEIVE_PORT = 3000;
const SEND_PORT = 3001;
let broadcastIP = UDP.getBroadcastIP();
UDP.addListener(RECEIVE_PORT, function(data, remote) {
console.log(`${remote.address}:${remote.port} says >`, data);
});
UDP.send("string message", broadcastIP, SEND_PORT);
0.0.775
5 years ago
0.0.774
5 years ago
0.0.773
5 years ago
0.0.772
5 years ago
0.0.771
5 years ago
0.0.77
5 years ago
0.0.76
5 years ago
0.0.75
5 years ago
0.0.74
5 years ago
0.0.73
5 years ago
0.0.72
5 years ago
0.0.71
5 years ago
0.0.7
5 years ago
0.0.6
5 years ago
0.0.5
5 years ago
1.0.0
5 years ago
0.0.4
6 years ago
0.0.3
6 years ago
0.0.2
6 years ago
0.0.1
6 years ago