forwarder-node
Node.js binding for forwarder
Install
npm i forwarder-node
Requirement
cmake-js >= 3.3.1
You should install cmake-js by running the following command:
npm i cmake-js -g
Usage
Basically, create a forwader object
let forwarder = ;let fwd = ;
member functions
fwd;
fwd;
// useful in client modefwd;
const option = "id": 1 // server's unique ID "desc": "description of this server" "netType": "enet" // or "ws" "port": 9999 "peers": 3000 "encrypt": true // optional. AES-128 encryption. if encrypt is true, then must provide an encryptkey "encryptkey": "1234567812345678" // length must be 16 (128 bits) "compress": true // optional "base64": true // optional // below options are used for client mode "isClient": true "address": "localhost" "reconnect": true;const serverId = fwd;
fwd;
const evt = fwd;
let serverId = fwd;
let clientId = fwd;
fwd;
fwd;
let packet = fwd;// packet is JS Buffer
fwd;
Tutorial
run the three js file:
test_server.js
test_client1.js
test_client2.js
Reference
Please go to the forwarder homepage.