Skip to main content

Installation

Install the walkerOS node client, via NPM:

npm install @elbwalker/client-node

Use the nodeClient function to create a new client instance. It returns the elb function for configuration via commands and pushing events, and the instance itself.

import { nodeClient } from '@elbwalker/client-node';
const { elb, instance } = nodeClient({});

Configuration

There a few configuration options when creating a node client instance:

OptionTypeDescription
consentobjectInitial consent states
customobjectIndividual information
destinationsobjectDestinations that might process the events
globalsStaticobjectStatic values for the globals that persist new runs
onErrorfunctioncustom error handler
onLogfunctioncustom logging for the verbose mode
sourceobjectTo define the events origin (type, id, previous_id)
verbosebooleanTo enable verbose mode
const { instance } = nodeClient({
consent: {
functional: true,
},
custom: {
foo: 'bar',
},
destinations: {
log: {
type: 'log',
push: console.log,
},
},
globalsStatic: {
version: '3.1.4',
},
onError: (error) => {
console.error('node client', error);
},
onLog: (message) => {
console.log('node client', message);
},
source: {
type: 'server',
id: '',
previous_id: '',
},
verbose: true,
});