diff --git a/src/main/java/org/java_websocket/client/WebSocketClient.java b/src/main/java/org/java_websocket/client/WebSocketClient.java index 1ac2df07..0e38326d 100644 --- a/src/main/java/org/java_websocket/client/WebSocketClient.java +++ b/src/main/java/org/java_websocket/client/WebSocketClient.java @@ -327,6 +327,21 @@ public boolean reconnectBlocking() throws InterruptedException { return connectBlocking(); } + /** + * Same as reconnect but blocks with a timeout until the websocket connected or failed + * to do so.
+ * + * @param timeout The connect timeout + * @param timeUnit The timeout time unit + * @return Returns whether it succeeded or not. + * @throws InterruptedException Thrown when the threads get interrupted + * @since 1.6.1 + */ + public boolean reconnectBlocking(long timeout, TimeUnit timeUnit) throws InterruptedException { + reset(); + return connectBlocking(timeout, timeUnit); + } + /** * Reset everything relevant to allow a reconnect *