Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How to close a connection (disconnect stop script working) #242

Unanswered
Barabba11 asked this question in Q&A
Discussion options

Hi, I'm not an expert of HTML, I've managed to do what I need, simply change scene onclick event, but every time the click comes a new connection has been made to the port 4444, if I use the disconnection the script doesn't work more, how to solve it?
Instead of open/close the connection on every click I would like to test if the connection is on already? Possibile? Even if the HTML page will change? (on every html page there is

<head>
	<script type="text/javascript" src="http://192.168.24.2/OBS-WebSocket.js"></script>
 ....

and I'm afraid the script will be "rebooted" every time, loosing the chance to know if it still connected or not.

Talking back about disconnect();

<script>
function setCurrentScene(scenename) {
const obs = new OBSWebSocket();
	obs.connect({address: '192.168.24.2:4444'
 });
	obs.on('ConnectionOpened', () => {
		obs.send('SetCurrentScene', {
 'scene-name': scenename
 });
	});
	//obs.disconnect();
	}
</script>

Works but if I uncomment the obs.disconnect(); it won't work never.
Thank you

You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant
Converted from issue

This discussion was converted from issue #238 on June 12, 2021 15:29.

AltStyle によって変換されたページ (->オリジナル) /