configurable port for osc bridge + add bin field
This commit is contained in:
parent
98b7003504
commit
5445f0812f
2 changed files with 15 additions and 1 deletions
|
|
@ -3,6 +3,7 @@
|
||||||
"version": "1.2.4",
|
"version": "1.2.4",
|
||||||
"description": "OSC messaging for strudel",
|
"description": "OSC messaging for strudel",
|
||||||
"main": "osc.mjs",
|
"main": "osc.mjs",
|
||||||
|
"bin": "./server.mjs",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"main": "dist/index.mjs"
|
"main": "dist/index.mjs"
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,19 @@ This program is free software: you can redistribute it and/or modify it under th
|
||||||
|
|
||||||
import OSC from 'osc-js';
|
import OSC from 'osc-js';
|
||||||
|
|
||||||
|
const args = process.argv.slice(2);
|
||||||
|
function getArgValue(flag) {
|
||||||
|
const i = args.indexOf(flag);
|
||||||
|
if (i !== -1) {
|
||||||
|
const nextIsFlag = args[i + 1]?.startsWith('--') ?? true;
|
||||||
|
if (nextIsFlag) return true;
|
||||||
|
return args[i + 1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let udpClientPort = Number(getArgValue('--port')) || 57120;
|
||||||
|
// dirt = 7771
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
receiver: 'ws', // @param {string} Where messages sent via 'send' method will be delivered to, 'ws' for Websocket clients, 'udp' for udp client
|
receiver: 'ws', // @param {string} Where messages sent via 'send' method will be delivered to, 'ws' for Websocket clients, 'udp' for udp client
|
||||||
udpServer: {
|
udpServer: {
|
||||||
|
|
@ -17,7 +30,7 @@ const config = {
|
||||||
},
|
},
|
||||||
udpClient: {
|
udpClient: {
|
||||||
host: 'localhost', // @param {string} Hostname of udp client for messaging
|
host: 'localhost', // @param {string} Hostname of udp client for messaging
|
||||||
port: 57120, // @param {number} Port of udp client for messaging
|
port: udpClientPort, // @param {number} Port of udp client for messaging
|
||||||
},
|
},
|
||||||
wsServer: {
|
wsServer: {
|
||||||
host: 'localhost', // @param {string} Hostname of WebSocket server
|
host: 'localhost', // @param {string} Hostname of WebSocket server
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue