obs-websocket-community-projects / obs-websocket-js

Consumes https://github.com/obsproject/obs-websocket
MIT License
667 stars 96 forks source link

Remote 2 obs instances #200

Closed fgraux closed 3 years ago

fgraux commented 4 years ago

Hi there, I'm working on a node app to remote and link several services (Obs studio, casparCG, Xkeys keyboards...) and it fails to connect to two obs instances: the app worked well untill I added the OBS AUX Device function (see the third function in my code). When the second obs server is called, it crashes immediately. Basically, it this possible to connect 2 devices with the excellent obs-websocket-js ? Thanks for your help

`//Connect to an OBS MAIN Device function obsMain_detect(obsIP,callback){ obs.connect({ address: obsIP, password: '' }).then(() => { obs_List(function(err, response){ if(!err){ term(response); } }); }).catch(console.error); callback(undefined, "\n"+dateTimeNow()+"\t^#^M^W OBS AUX ^ \tOBS MAIN INSTANCE Connected: \t"+obsIP) }

// OBS: Get Scenes & sources List from the main obs async function obs_List(callback){ var nlist; let obsList = await obs.send('GetSceneList').then(() => { return obs.send('GetSceneList'); }) .then(data => { nlist = (${data.scenes.length}); data.scenes.forEach(scene => {
obsSceneL +=(${scene.name}+';'); }); }).catch(console.error); obsSceneL = obsSceneL.replace('undefined',''); IOSendData(['web'], 'obslist', obsSceneL); callback(undefined, "\n"+dateTimeNow()+"\t^#^B^W \t ^ \tOBS Scenes List Loaded: "+nlist+" Scenes! \t ^ \t"+obsSceneL) }

//Connect to an OBS AUX Device function obsAux_detect(obsAux,callback){ if (obsAux!= ''){ obsAUX1.connect({ address: obsAux, password: '' }).catch(console.error); callback(undefined, "\n"+dateTimeNow()+"\t^#^M^W OBS AUX ^ \tOBS AUX INSTANCE Connected: \t"+obsAux) }}`

Versions Used (if applicable):