Skip to content

de-things/delib-web-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🐈Install/Usage

Create any TS/JS web project (frontend/backend, I don't mind) and clone delib.js into the somewhere. Then create a DelibDevice class instance to communicate with your de:things devices based on delib serverside.

You can check ./tests/ directory to understand, how frontend calls work, using a local expressjs server, emulating delib device handlers.

SDK is the big word for this file, but it is what it is.

🐈Example code

// Wlan call example:
var device = new DelibDevice("device_ip", "TEST_SECRET"); // constructor(ip, secret);

device.call("example").then(res => {
    console.log(res); // device response
});

// Why WLAN? because device SECRET has been DEFINED in the constructor,
// so this example call sends a POST request to the "http://device_ip:80/example"
// with a SECRET in the request body.
// Ethernet call example:
var device = new DelibDevice("device_ip"); // constructor(ip);

device.call("example").then(res => {
    console.log(res); // device response
});

// Why ETHERENET? because device SECRET has NOT been DEFINED in the constructor,
// so this example call sends a POST request to the "http://device_ip:80/"
// with a body content equal to: "!example".

Check delib to understand requests mechanics more.

About

de:things SDK for web applications.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published