Requirements
Node 10+
Usage
Configuration Options
Configuration options with defaults that can be passed to the constructor.
options
Server
import ShoulderTapServer from 'shoulder-tap'
const shoulderTapServer = new ShoulderTapServer({
type: 'udp4',
HOST: '127.0.0.1',
PORT: 3131,
})
shoulderTapServer.addListener(key, func)
shoulderTapServer.removeListener(key)
Client
import ShoulderTapClient from 'shoulder-tap'
const shoulderTapClient = new ShoulderTapClient({
type: 'udp4',
HOST: '127.0.0.1',
PORT: 3131,
})
shoulderTapClient.setErrorListener((err) => {
log.error(err)
})
shoulderTapClient.sendBestEffort(JSON.stringify({ key: 'testKey', value: 'testValue' }))
Getting started
npm i -S shoulder-tap
Testing
Command line
Ubuntu
npm run testServer
npm run testClient
OR
echo -n "{\"key\":\"hello\"}" >/dev/udp/localhost/3131
OR
echo -n "{\"key\":\"hello\"}" | nc -4u -w0 localhost 3131
More information
See the tests and implementation files.