From ed3534992128f1e93b4e609857bd481b668717a4 Mon Sep 17 00:00:00 2001 From: Tom Wojciechowski Date: Fri, 25 Oct 2024 23:22:59 +0100 Subject: [PATCH] ping --- build.gradle | 2 +- common/build.gradle | 2 +- .../java/com/github/czyzby/websocket/impl/NvWebSocket.java | 3 +++ gradle/wrapper/gradle-wrapper.properties | 2 +- ios/build.gradle | 2 +- .../java/com/github/czyzby/websocket/impl/NvWebSocket.java | 3 +++ serialization/build.gradle | 2 +- 7 files changed, 11 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 5da33e9..3588260 100644 --- a/build.gradle +++ b/build.gradle @@ -21,7 +21,7 @@ buildscript { allprojects { apply plugin: "eclipse" apply plugin: "idea" - apply plugin: "maven" + apply plugin: "maven-publish" ext { minSdk = 16 diff --git a/common/build.gradle b/common/build.gradle index 6782940..46fcaea 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -2,5 +2,5 @@ apply plugin: 'java-library' dependencies { api project(":core") - compile "com.neovisionaries:nv-websocket-client:$nvVersion" + api "com.neovisionaries:nv-websocket-client:$nvVersion" } diff --git a/common/src/main/java/com/github/czyzby/websocket/impl/NvWebSocket.java b/common/src/main/java/com/github/czyzby/websocket/impl/NvWebSocket.java index bdf660f..5fec4d8 100644 --- a/common/src/main/java/com/github/czyzby/websocket/impl/NvWebSocket.java +++ b/common/src/main/java/com/github/czyzby/websocket/impl/NvWebSocket.java @@ -26,6 +26,9 @@ public void connect() throws WebSocketException { try { dispose(); final WebSocket currentWebSocket = webSocket = webSocketFactory.createSocket(getUrl()); + + webSocket.setPingInterval(5000); + currentWebSocket.addListener(new NvWebSocketListener(this)); currentWebSocket.connectAsynchronously(); } catch (final Throwable exception) { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f4d7b2b..ffed3a2 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/ios/build.gradle b/ios/build.gradle index 0ec5d10..c3165ee 100644 --- a/ios/build.gradle +++ b/ios/build.gradle @@ -13,7 +13,7 @@ eclipse { dependencies { api project(":core") - compile "com.neovisionaries:nv-websocket-client:$nvVersion" + api "com.neovisionaries:nv-websocket-client:$nvVersion" implementation "com.mobidevelop.robovm:robovm-rt:$roboVMVersion" implementation "com.mobidevelop.robovm:robovm-cocoatouch:$roboVMVersion" implementation "com.badlogicgames.gdx:gdx:$gdxVersion" diff --git a/ios/src/main/java/com/github/czyzby/websocket/impl/NvWebSocket.java b/ios/src/main/java/com/github/czyzby/websocket/impl/NvWebSocket.java index 17244a4..4f8e3df 100644 --- a/ios/src/main/java/com/github/czyzby/websocket/impl/NvWebSocket.java +++ b/ios/src/main/java/com/github/czyzby/websocket/impl/NvWebSocket.java @@ -30,6 +30,9 @@ private void setSNIForSocket (Socket socket) { public NvWebSocket(final String url) { super(url); + + webSocket.setPingInterval(5000); + webSocketFactory.setVerifyHostname(verifyHostname); webSocketFactory.setSSLSocketFactory(new OpenSSLSocketFactoryImpl() { diff --git a/serialization/build.gradle b/serialization/build.gradle index 2fd33d5..12796cf 100644 --- a/serialization/build.gradle +++ b/serialization/build.gradle @@ -3,6 +3,6 @@ apply plugin: 'java-library' dependencies { implementation "com.badlogicgames.gdx:gdx:$gdxVersion" api project(":core") - testCompile "junit:junit:4.12" + testImplementation "junit:junit:4.12" }