{"id":48866,"library":"osc-js","title":"osc-js","description":"osc-js is an Open Sound Control (OSC) library for JavaScript, supporting Node.js and browser environments via UMD module. Current stable version is 2.4.1 (released monthly). It provides address pattern matching, timetag handling, built-in UDP, WebSocket, and bridge plugins, and a customizable Plugin API. Key differentiators include zero dependencies (except ws for Node.js), TypeScript definitions, and support for all OSC 1.0 specifications plus extended argument types.","status":"active","version":"2.4.1","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/adzialocha/osc-js","tags":["javascript","osc","data","open","sound","control","websocket","udp","datagram","typescript"],"install":[{"cmd":"npm install osc-js","lang":"bash","label":"npm"},{"cmd":"yarn add osc-js","lang":"bash","label":"yarn"},{"cmd":"pnpm add osc-js","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"WebSocket support in Node.js environments","package":"ws","optional":true}],"imports":[{"note":"Default export; UMD module works in Node and browser.","wrong":"const OSC = require('osc-js').OSC","symbol":"OSC","correct":"import OSC from 'osc-js'"},{"note":"Message is a static property of the default export, not a named export.","wrong":"import { Message } from 'osc-js'","symbol":"OSC.Message","correct":"import OSC from 'osc-js'; const msg = new OSC.Message('/path', 1, 2)"},{"note":"Plugins are properties of the OSC class; not exported directly.","wrong":"import { WebsocketClientPlugin } from 'osc-js'","symbol":"OSC.WebsocketClientPlugin","correct":"import OSC from 'osc-js'; new OSC.WebsocketClientPlugin()"}],"quickstart":{"code":"import OSC from 'osc-js';\n\nconst osc = new OSC();\n\nosc.on('/greeting', (message) => {\n  console.log('Received:', message.args);\n});\n\nosc.on('open', () => {\n  const msg = new OSC.Message('/greeting', 'Hello OSC!');\n  osc.send(msg);\n});\n\nosc.open({ port: 9000 });\n\n// In a browser, default WebSocket client tries ws://localhost:8080","lang":"javascript","description":"Shows basic setup: create OSC instance, listen for messages, send a message on open, and start listening on UDP port 9000."},"warnings":[{"fix":"Use `new OSC({ plugin: new OSC.DatagramPlugin() })` instead of `new OSC(OSC.DatagramPlugin())`","message":"In osc-js v2, the constructor signature changed: `new OSC(config)` where config is an options object, not separate arguments.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use standard timetag format: [seconds, fractional_seconds]","message":"OSC.Bundle and timetag handling use the 'timetag' library; timetag representation may change in future versions.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Assign listener once; avoid calling `osc.on('open', ...)` inside other callbacks.","message":"When using `osc.on('open', callback)`, the callback may be called multiple times if reconnection occurs; only one listener is recommended.","severity":"gotcha","affected_versions":"*"},{"fix":"Wait for 'open' event before calling `osc.send()`.","message":"In browser, the default WebSocket client must be connected before sending messages; otherwise, messages are queued but not sent.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"search_vec":"'1.0':67 '2.4.1':28 'address':33 'api':50 'argument':71 'bridg':44 'browser':19 'built':39 'built-in':38 'control':11,78 'current':24 'customiz':48 'data':75 'datagram':81 'definit':61 'depend':55 'differenti':52 'environ':20 'except':56 'extend':70 'handl':37 'includ':53 'javascript':15,73 'js':3,6 'key':51 'librari':13 'match':35 'modul':23 'month':30 'node.js':17,59 'open':9,76 'osc':2,5,12,66,74 'osc-j':1,4 'pattern':34 'plugin':45,49 'plus':69 'provid':32 'releas':29 'sound':10,77 'specif':68 'stabl':25 'support':16,63 'timetag':36 'type':72 'typescript':60,82 'udp':41,80 'umd':22 'version':26 'via':21 'websocket':42,79 'ws':57 'zero':54","created_at":"2026-06-07T16:58:52.016484+00:00","updated_at":"2026-06-07T16:58:52.016484+00:00","problems":[{"fix":"Use `import OSC from 'osc-js'` instead of `import { OSC } from 'osc-js'`","cause":"Using named import instead of default import in TypeScript.","error":"TypeError: osc_js_1.default is not a constructor"},{"fix":"Run `npm install bufferutil` or set `npm config set optional false`","cause":"Optional WebSocket dependency missing in Node.js.","error":"Error: Module not found: Error: Can't resolve 'bufferutil'"},{"fix":"Start a WebSocket server (e.g., with OSC.WebsocketServerPlugin) on port 8080.","cause":"No WebSocket server running or wrong port.","error":"WebSocket connection to 'ws://localhost:8080/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/adzialocha/osc-js#readme","github":"ssh://git@github.com/adzialocha/osc-js","docs":null,"changelog":null,"pypi":null,"npm":"osc-js","openapi_spec":null,"status_page":null,"smithery":null,"categories":["messaging"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}