Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Connect #161

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ public void connect() {
// Block on the connection succeeding
connection.get(this.connectionTimeoutSeconds, TimeUnit.SECONDS);
} catch (Throwable t) {
try {
this.webSocketClient.stop();
} catch (Exception ignored) {}
// If the exception is caused by OBS being unavailable over the network
// (or not installed or started), then call onError with helpful message
if (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package io.obswebsocket.community.client;

import java.util.function.Consumer;

import org.eclipse.jetty.websocket.client.WebSocketClient;

import io.obswebsocket.community.client.listener.lifecycle.LifecycleListenerBuilderFacade;
import io.obswebsocket.community.client.listener.lifecycle.controller.ControllerLifecycleListenerBuilder;
import io.obswebsocket.community.client.message.event.Event;
import java.util.function.Consumer;
import lombok.Getter;
import org.eclipse.jetty.websocket.client.WebSocketClient;

/**
* The internal builder for creating ${@link OBSRemoteController} instances.
Expand All @@ -18,8 +16,8 @@ public class OBSRemoteControllerBuilder {
private final OBSCommunicatorBuilder obsCommunicatorBuilder = new OBSCommunicatorBuilder();
private final LifecycleListenerBuilderFacade lifecycleListenerBuilderFacade = new LifecycleListenerBuilderFacade(
this,
obsCommunicatorBuilder.lifecycle(),
controllerLifecycleListenerBuilder
this.obsCommunicatorBuilder.lifecycle(),
this.controllerLifecycleListenerBuilder
);
private OBSCommunicator communicator;

Expand All @@ -40,7 +38,7 @@ public OBSRemoteControllerBuilder port(int port) {
}

public OBSRemoteControllerBuilder password(String password) {
obsCommunicatorBuilder.password(password);
this.obsCommunicatorBuilder.password(password);
return this;
}

Expand All @@ -61,7 +59,7 @@ public OBSRemoteControllerBuilder autoConnect(boolean autoConnect) {
}

public LifecycleListenerBuilderFacade lifecycle() {
return lifecycleListenerBuilderFacade;
return this.lifecycleListenerBuilderFacade;
}

public OBSRemoteControllerBuilder communicator(OBSCommunicator communicator) {
Expand All @@ -72,15 +70,15 @@ public OBSRemoteControllerBuilder communicator(OBSCommunicator communicator) {
public OBSRemoteController build() {

return new OBSRemoteController(
webSocketClient,
communicator == null
? obsCommunicatorBuilder.build()
: communicator,
controllerLifecycleListenerBuilder.build(),
host,
port,
connectionTimeoutSeconds,
autoConnect
this.webSocketClient,
this.communicator == null
? this.obsCommunicatorBuilder.build()
: this.communicator,
this.controllerLifecycleListenerBuilder.build(),
this.host,
this.port,
this.connectionTimeoutSeconds,
this.autoConnect
);

}
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dependencyResolutionManagement {
versionCatalogs {
libs {
library('lombok', 'org.projectlombok:lombok:1.18.24')
library('websocket', 'org.eclipse.jetty.websocket:websocket-client:9.4.49.v20220914')
library('websocket', 'org.eclipse.jetty.websocket:websocket-client:9.4+')
library('gson', 'com.google.code.gson:gson:2.9.0')
library('sl4j-api', 'org.slf4j:slf4j-api:2.0.3')
library('sl4j-simple', 'org.slf4j:slf4j-simple:2.0.3')
Expand Down