1.1.3 • Published 4 years ago

osc-ipc-client v1.1.3

Weekly downloads
3
License
ISC
Repository
github
Last release
4 years ago

osc-ipc-client

A client for sending and recieving messages to/from an Interprocess Connection.

Install:

npm install osc-ipc-client

Constructor:

const IpcClient = require("osc-ipc-client");
const client = new IpcClient(options);

Options:

const options = {
  targetPort: 9999,
  targetHost: '127.0.0.1',
  header: 0xf2b49e2c, // default for connecting to a JUCE IPC
  timeout: 3000, 
  isUnixDomainSocket: false,
};
KeyValue
targetPortTarget port
targetHostTarget host or Unix Domain Socket pathname
headerA 32 bit unsigned integer
timeoutTimeout, in milliseconds, for connecting to the server
isUnixDomainSocketBoolean, indicating whether or not targetHost is a Unix Domain Socket

Usage:

oscObject = {
  address: '/recieve',
  args: [
    { type: 'string', value: "This is an osc message from IpcClient"}
  ],
};

// event 'res' occurs when a response is recieved from the server.
client.on("res", (data, address)=>{
  console.log(data, 'from', address);
});

// event 'connect' occurs when the TCP connection is connected.
client.on("connect", ()=>{
  client.sendOsc([oscObject, oscObject]) // can send OSC bundles
  .then(client.sendOsc(oscObject) // can send OSC messages
  .then(client.sendString("hello") // can send strings
  .then(()=>{
      client.close();
  })));
});
1.1.3

4 years ago

1.1.1

4 years ago

1.1.2

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago