Updated no-obs-ws
Added check to see if _auth_required is already connected to.
This commit is contained in:
parent
e4637479e9
commit
3804940b22
1 changed files with 5 additions and 1 deletions
|
|
@ -24,10 +24,14 @@ signal event_received(event: Message)
|
||||||
signal _auth_required()
|
signal _auth_required()
|
||||||
|
|
||||||
|
|
||||||
|
func is_open() -> bool:
|
||||||
|
return _ws != null and _ws.get_ready_state() == WebSocketPeer.STATE_OPEN
|
||||||
|
|
||||||
func connect_to_obsws(port: int, host: String = "127.0.0.1", password: String = "") -> void:
|
func connect_to_obsws(port: int, host: String = "127.0.0.1", password: String = "") -> void:
|
||||||
_ws = WebSocketPeer.new()
|
_ws = WebSocketPeer.new()
|
||||||
_ws.connect_to_url(WS_URL % [host,port])
|
_ws.connect_to_url(WS_URL % [host,port])
|
||||||
_auth_required.connect(_authenticate.bind(password))
|
if not _auth_required.is_connected(_authenticate):
|
||||||
|
_auth_required.connect(_authenticate.bind(password))
|
||||||
|
|
||||||
|
|
||||||
func disconnect_from_obsws() -> void:
|
func disconnect_from_obsws() -> void:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue