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

Add setPingInterval, sendPing function & Setting gradle enable to build in 2025 #62

Open
wants to merge 3 commits into
base: master
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# From https://github.com/github/gitignore/blob/master/Gradle.gitignore
.gradle
/build/
local.properties

# Ignore Gradle GUI config
gradle-app.setting
Expand Down
19 changes: 1 addition & 18 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 2 additions & 14 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions .idea/modules.xml

This file was deleted.

12 changes: 0 additions & 12 deletions .idea/modules/SocketclusterClientJava.iml

This file was deleted.

15 changes: 0 additions & 15 deletions .idea/modules/SocketclusterClientJava_main.iml

This file was deleted.

17 changes: 0 additions & 17 deletions .idea/modules/SocketclusterClientJava_test.iml

This file was deleted.

72 changes: 14 additions & 58 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
plugins {
id "com.jfrog.bintray" version "1.8.4"
id 'java'
}

repositories {
jcenter()
mavenCentral()
google()
maven { url 'https://repo.grails.org/grails/core/' }
}

allprojects {
tasks.withType(JavaCompile) {
sourceCompatibility = '1.7'
targetCompatibility = '1.7'
sourceCompatibility = '17'
targetCompatibility = '17'
}
}

Expand All @@ -20,64 +21,19 @@ version '2.0.0'

allprojects {
repositories {
jcenter()
mavenLocal()
google()
mavenCentral()
maven { url 'https://jitpack.io' }
maven { url 'https://repo.grails.org/grails/core/' }
}
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'maven-publish'
}

task sourceJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allJava
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

publishing {
publications {
MyPublication(MavenPublication) {
from components.java
groupId 'io.github.sac'
artifactId 'SocketclusterClientJava'
version this.version

artifact sourceJar {
classifier "sources"
}

artifact javadocJar {
classifier "javadoc"
}
}
}
}


bintray{
user=System.getenv('BINTRAY_USER')
key=System.getenv('BINTRAY_API_KEY')
// configurations = ['archives']
publications = ['MyPublication']
pkg {
repo = 'Maven'
name = 'socketcluster-client'
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/sacOO7/socketcluster-client-java.git'
publicDownloadNumbers = true

version {
name = this.version
desc = 'Fixed ping pong isse in accordance with new sc release'
vcsTag = this.version
}
}
java {
withSourcesJar()
}

dependencies {
compile 'com.neovisionaries:nv-websocket-client:1.30'
compile group: 'org.json', name: 'json', version: '20090211'
implementation 'com.neovisionaries:nv-websocket-client:2.14'
implementation group: 'org.json', name: 'json', version: '20241224'
}
6 changes: 3 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Feb 06 20:50:06 IST 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-all.zip
#Mon Jan 06 13:33:35 KST 2025
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
40 changes: 40 additions & 0 deletions src/main/java/io/github/sac/Socket.java
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,46 @@ public void disconnect() {
strategy = null;
}

public Socket setPingInterval(long time){
EventThread.exec(new Runnable() {
public void run() {
ws.setPingInterval(time);
}
});

return this;
}

public Socket sendPing(){
EventThread.exec(new Runnable() {
public void run() {
ws.sendPing();
}
});

return this;
}

public Socket setPongInterval(long time){
EventThread.exec(new Runnable() {
public void run() {
ws.setPongInterval(time);
}
});

return this;
}

public Socket sendPong(){
EventThread.exec(new Runnable() {
public void run() {
ws.sendPong();
}
});

return this;
}

/**
* States can be
* CLOSED
Expand Down