Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions PUBLIC_API.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,15 @@ const obs = new OBSWebSocket();
/**
* Connect to OBS-websocket
*/
async function connect(port:string, pass:string):Promise<boolean> {
async function connect():Promise<boolean> {
try {
await obs.connect("ws://127.0.0.1:"+port, pass, {rpcVersion:1});
}catch(error) {
setTimeout(()=> {
//try again later
connect(port, pass);
}, 5000);
return false;
}
obs.addListener("ConnectionClosed", ()=> {
//Reconnect
connect(port, pass);
connect();
});

//@ts-ignore ("CustomEvent" not yet declared in obs-websocket-js types. Need ts-ignore to avoid compilation error)
Expand Down