1.0.1 • Published 5 years ago
smalldb-client v1.0.1
SmallDB-Client
This library is the official client for SmallDB-Server.
The library is intended to be small and run on low-memory devices. For further information take a look at SmallDB-Server.
Client
JS
const HTTPClient = require('./dist/index').default.HTTP;
const SocketClient = require('./dist/index').default.Socket;
const clientHttp = new HTTPClient.Client();
const clientSocket = new SocketClient.Client();
//get data
Client.get()
.then( result => {
const value = result.data;
//if upload pipeline is broken QoS is served with method 'nack' on //result => result.nack();
result.ack()
.then( () => {
/* do some stuff */
});
})
//set data
Client.set( data )
.then( result => {
console.log('result: ', result);
})
TS
import DB from 'SmallDB-Client';
const Client : Client.HTTP.Client = new Client.HTTP.Client( [ host = 'localhost', port = 3000 ] );
Client.get()
.then( data : Types.ClientPoint => {
const value : <YourType> = data.data;
//if upload pipeline is broken QoS is served with method 'nack' on //result => result.nack();
result.ack()
.then( () => {
/* do some stuff */
});
})
1.0.1
5 years ago