Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot get to run on Node 20 #120

Closed
logicallysynced opened this issue Jun 21, 2024 · 2 comments
Closed

Cannot get to run on Node 20 #120

logicallysynced opened this issue Jun 21, 2024 · 2 comments

Comments

@logicallysynced
Copy link

logicallysynced commented Jun 21, 2024

I'm trying to get this to run on Node 20.14.0 (Typescript) and for the life of me I cannot figure out what's going on. As soon as import { Server, Client } from 'node-osc'; exists in the code, the NodeJS process immediately closes upon launch, no errors or uncaught exceptions - nothing. As soon as I remove the import, everything is working again.

This is my code, but i'm not even calling setupOscClient() or setupOscServer() and it still crashes randomly. I can't get a debugger attached to it either because of this behaviour. Any help would be appreciated.

import { Server, Client } from 'node-osc';

let oscClient: Client | null = null;
let oscServer: Server | null = null;

function setupOscClient() {
    if (globalSettings.enableComs !== '1') {
        return;
    }

    const ipAddress = globalSettings.ipAddress || '127.0.0.1';
    const port = 10024;

    if (oscClient) {
        oscClient.close();
        globalSettings.oscConnected = false;
        saveGlobalSettings();
    }

	try {
		oscClient = new Client(ipAddress, port);
		globalSettings.oscConnected = true;
		saveGlobalSettings();

		ConsoleLog(`Connected to ${ipAddress}:${port}`, LogLevel.INFO, true);
	} catch (err) {
		console.log(err)
	}
    
}

function setupOscServer() {
	const ipAddress = globalSettings.ipAddress || '127.0.0.1';
    const port = 10024;
    
    if (oscServer) {
        oscServer.close();
    }

    oscServer = new Server(port, ipAddress);
    oscServer.on('message', function (msg) {
        ConsoleLog(`Received OSC message: ${msg}`, LogLevel.INFO, true);
        handleIncomingData(msg.toString());
    });

    ConsoleLog(`OSC server listening on port ${port}`, LogLevel.INFO, true);
}


@logicallysynced
Copy link
Author

Further debugging is showing that oscClient = new Client(ipAddress, port); or oscServer = new Server(port, ipAddress); is directly causing the issue, where it refuses to load.

@logicallysynced
Copy link
Author

Seems like this was the problem: #112

bintools needed refactoring and patching.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant