npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

iot-io-companion

v0.1.1

Published

remote access iot io

Readme

IOT IO Library for Companion

Remotely call iot-io built-in Arduino like functions and user-defined functions. Make sure an iot-io-server is running before you use this library.

Quick start

Call built-in APIs

The only difference to iot-io library is to denote remote RPC server's address & port and enable rpc client. Below example demo.js has shown how to enable rpc request and use user defined function

var IOLIB = (typeof require === 'function') ?
            require('iot-io-companion'): this.IOLIB;

var io = new IOLIB.IO({
  rpc: true,  // turn on rpc call
  port: 2000, // port of RPC server
  hostname: 'localhost', //address or machine name of RPC server
});

// directly use built-in Arduino functions
io.pinMode(13, io.OUTPUT);
io.digitalWrite(13, io.HIGH);

// add user-defined function in RPC server, 
io.addRpc('myFun');
// then use it as normal method
io.myFun('world'); 

Then IOT device which runs iot-io-server can receive the RPC request and execute these functions.

iot-io-server

Call user defined functions

The iot-io-server can expose user defined functions. Below file extra.js can expose function Foo as myFun

var Foo = function(s) {
  console.log('hello ' + s);
};

if(isRpcServer) {
  exports.RPC = {
    'myFun': Foo
  };
}

Run server with extra.js

iot-io-server extra.js

In companion device you can call myFun by

var IOLIB = (typeof require === 'function') ?
            require('iot-io-companion'): this.IOLIB;

var io = new IOLIB.IO({
  rpc: true,
  port: 2000,
  hostname: 'localhost',
});

io.addRpc('myFun');

myFun('world'); //will output 'hello world'

Execution environment

iot-io-companion can run in nodejs and browser. In nodejs please load it as normal module. In browser please load the file iot-io-browser-general.js or `iot-io-browser-general.min.js', it has contained all of dependent libraries except for jquery, so you need to load jquery before it.

<script src = 'http://code.jquery.com/jquery-1.11.0.min.js'> </script>
<script src = './iot-io-browser-general.js'></script>
<script src = './led_rpc.js'></script>

APIs

Arduino like APIs

It shares almost the same APIs with iot-io library except for below APIs. Please read the [API document] ( http://ilc-opensource.github.io/io-js/doc) to know more details

new IO(options)

Only list the extra options here compares to iot-io.

  • options.rpc (boolean). Set it true to enable RPC calls.
  • options.port(integer, default is 2000). Port of remote iot-io-server
  • options.hostname(string). The hostname or ip address of iot-io-server

io.addRpc(funName)

Added a remote user-defined function

  • funName(string). The name of user-defined function

License

The BSD License