const serverAddress = '192.168.2.1'; // Replace with the OSC server's IP address const serverPort = 8080; // Replace with the OSC server's port function sendOSCMessage(address, data) { const message = createOSCMessage(address, data); const socket = new WebSocket(`ws://${serverAddress}:${serverPort}`); socket.addEventListener('open', () => { socket.send(message); console.log('WebSocket message sent successfully'); }); socket.addEventListener('error', (error) => { console.error('Error with WebSocket connection:', error); }); } function createOSCMessage(address, data) { // Create an OSC message based on the address and data // Return the serialized OSC message as a string } // Example usage sendOSCMessage('/my/message', 'Hello, OSC!');