Socket
Book a DemoInstallSign in
Socket

wish-core-api

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wish-core-api

Wish API for node. Used for building Wish Apps.

0.4.0-beta-5
latest
Source
npmnpm
Version published
Weekly downloads
5
150%
Maintainers
2
Weekly downloads
 
Created
Source

Wish Api

A native node.js plugin for building Wish applications. Currently working with Linux x86_64 and nodejs v6.x only. To get it working you need to run a Wish Core on the same host.

Install

npm install wish-core-api

Example

var WishApp = require('wish-core-api').WishApp;

function App() {
    var app = new WishApp({ 
        name: process.env.SID || 'MyApp',
        corePort: parseInt(process.env.CORE) || 9094,
        protocols: ['test'] });

    app.on('ready', (ready) => {
        app.request('identity.create', ['John Doe'], (err, data) => {
            if (err && data.code === 304) { return console.log('Using existing identity'); }
            console.log('Identity created:', err, data);
        });
    });

    app.on('online', (peer) => {
        app.request('services.send', [peer, new Buffer('Permissionless innovation!')], (err, data) => {
            // sent or not?
        });
    });

    app.on('frame', (peer, data) => {
        app.request('identity.get', [peer.ruid], function(err, user) {
            console.log(user.alias, 'says:', data.toString());
        });
    });
}

var app = new App();

Keywords

wish

FAQs

Package last updated on 21 May 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.