0.1.7 • Published 6 years ago
data-tunnel v0.1.7
Data Tunnel
Local Debug Tool
Install
$ npm i data-tunnel
Usage
Publisher
import * as dt from "data-tunnel";
dt.setup({
receiver: false,
sender: true,
debug: false,
protocol: 'http',
host: 'localhost',
port: 3600,
});
const awesomeMethod = (data1: string, data2: number) => {
dt.service.emit("my-key", [data1, data2])
}
Receiver
import * as dt from "data-tunnel";
dt.setup({
receiver: true,
sender: false,
debug: false,
protocol: 'http',
host: 'localhost',
port: 3600,
});
const awesomeMethod = (data1: string, data2: number) => {
console.log("Hey", data1, data2)
}
dt.service.receive("my-key", awesomeMethod)
CLI
$ data-tunnel
$ data-tunnel -p 6501
$ data-tunnel -p 6501 --host 127.0.0.1
$ data-tunnel -p 6501 --debug
Development
Logic
$ yarn i
$ yarn start
UI
$ cd sample
$ npm i
$ npm start
Licence
MIT