Giter Club home page Giter Club logo

node-ha-ssdb-cli's Introduction

ha-node-ssdb

  1. if all ssdb-servers connect fail, throw error.
  2. npm install ha-ssdb-cli
  3. npm test
var co = require('co');
var wait = require('co-wait');
var hassdb = require('ha-ssdb-cli');

options = [
 {   
     host: '0.0.0.0',
     port: 8888,
     timeout: 0,
     promisify: true,  // make api methods promisify.
 },  
 {   
     host: '127.0.0.1',
     port: 38888,
     timeout: 0,
     promisify: true,  // make api methods promisify.
 }   
];

try {
 ssdb = new hassdb.createHAIns(options);
 co(function *() {
     var key = 'key';
     while (true) {
         console.log("----===--- 1");
         try {
             var a = yield ssdb.set(key, "123");
             console.log("----===--- 2");
             var b = yield ssdb.get(key);
             console.log("----===--- 3");
             var c = yield ssdb.info();
             console.log(a, b, c);  // 1 'val'
         } catch (err) {
             console.error(err.message);
         }   
         console.log('--- wait --- 1');
         yield wait(1000);
         console.log('--- wait --- 2');
         yield wait(1000);
         console.log('--- wait --- 3');
         yield wait(1000);
     }   
 });
} catch (err) {
 console.log('===---', err);
}

License

Copyright (c) 2014 Eleme, Inc. detail see LICENSE-MIT

node-ha-ssdb-cli's People

Contributors

charmingcode avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.