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 🙏

© 2024 – Pkg Stats / Ryan Hefner

iceoryx-nodejs-extended

v0.0.4

Published

Nodejs wrapper of iceoryx

Downloads

118

Readme

iceoryx-nodejs

this is bindning of iceoryx library for nodejs

Usage

There must be iceoryx installed in your system follow instructions

# Those variables are used to build addon, will find later way how to ged rid of this
export ICEORYX_NODEJS_LIB=/usr/local/lib
export ICEORYX_NODEJS_INCLUDE=/usr/local/include/iceoryx/<VERSION>
npm install iceoryx-nodejs

Environment

  • There is only linux environment tested right now

Example request/response

Client

const iceoryx = require('iceoryx-nodejs-extended')

iceoryx.setIoxProcessName("client_test");

const client = new iceoryx.IceoryxClient();

let resp = client.sendMessage("{koko : 10}");
console.log("got some resp:" + resp)

Server

const iceoryx = require('iceoryx-nodejs-extended')

iceoryx.setIoxProcessName("server_test");

const server = new iceoryx.IceoryxServer();
server.listen();

Example subsriber/publisher

const iceoryx = require('iceoryx-nodejs-extended')

// There must be name of iox process
// Second param - if "publisher" then application will push some JSON
const appArgs = process.argv.slice(2);

// Unique name of iox process
iceoryx.setIoxProcessName(appArgs[0]);

// Callback for subscriber
const canTopicCallback = (data, data2) => {
    console.log(data.data.toString());
}

if(appArgs[1] === "subscriber") {
    const service = new iceoryx.IceoryxSubscriber(["Test-app", "Test-group", "topic"], canTopicCallback);
    // Little hack by holding reference like that if not Garbage collector will destroy object
    process.on("exit", () => {
        console.log(service);
    })
} else {
    const publisher = new iceoryx.IceoryxPublisher(["Test-app", "Test-group", "topic"], canTopicCallback);
    let iteration = 0;
    setInterval(() => {
        // Sample JSON data
        const obj = {
            message: "Hello from the nodejs thru iceoryx",
            iteration
        }
        const str = JSON.stringify(obj);
        publisher.loan(str.length)
            .then((data) => {
                // We must fill data into received buffer
                data.fill(str);
                iteration++;
                // This can't be called without data received by function getLoanBuffer
                // There is buffer which has memory address from iox shared memory
                // Multiple call of loan without pusblish will lead to not getting buffer
                publisher.publish(data);
            })
            .catch(err => console.log(err))
    }, 100);
}

const BlockThread = async () => {
    while(1) {
        await new Promise(resolve => setTimeout(resolve, 5000));
    }   
}

BlockThread();

Running example

# first console (of course iox-roudi must running)
node iceoryx.js process_sub subscriber

# second console
node iceoryx.js process_pub publisher