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

Continuingly checking whether OBS has started... #329

Unanswered
mccombey asked this question in Q&A
Discussion options

I've developed a HTML interface for controlling OBS and all is working brilliantly. I have a small issue though. For various technical reasons, the HTML interface is launched first and then OBS starts later on. I'd like to check every 500ms whether OBS is open and then start controlling it using the WebSocket. I've been using a loop with something like this to check if the WebSocket is available. If yes, the connection is made and the loop is terminated. If there is no WebSocket, an error is fired and the checking loop continues after a fixed delay of 500ms.

try
{
	await obs.connect('ws://xx.x.xxx.x:4455', 'password');
	console.log("Connected!");
} 
catch (error)
{
	console.log("Not connected");
}

If OBS is open, then the connection is made immediately. If OBS is opened after a couple of seconds, the connection is normally made. However, if things are left for longer, it all goes astray.

If seems, when the error is fired the connection attempt doesn’t kill. So, when the attempt is repeated, these non-killed attempts build up and cause a blockage. The delay between attempts becomes exponentially larger.

Does anyone have a solution to kill the connecting process or a solution to continually check whether a WebSocket is available?

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

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