Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

General Java and Android client SDK for bidirectional communication with Centrifugo and Centrifuge-based server over WebSocket

License

NotificationsYou must be signed in to change notification settings

centrifugal/centrifuge-java

Repository files navigation

Websocket client forCentrifugo server andCentrifuge library.

There is no v1 release of this library yet – API still evolves. At the moment patch version updates only contain backwards compatible changes, minor version updates can have backwards incompatible API changes.

Check outclient SDK API specification to learn how this SDK behaves. It's recommended to read that before starting to work with this SDK as the spec covers common SDK behavior - describes client and subscription state transitions, main options and methods. Also check out examples folder.

The features implemented by this SDK can be found inSDK feature matrix.

The latestcentrifuge-java is compatible withCentrifugo server v6, v5 and v4 andCentrifuge >= 0.25.0. For Centrifugo v2, Centrifugo v3 and Centrifuge < 0.25.0 you should usecentrifuge-java v0.1.0.

Installation

Library available in Maven:https://search.maven.org/artifact/io.github.centrifugal/centrifuge-java

This library depends onstreamsupport-minifuture. In case your project has a dependency tostreamsupport-cfuture and you have a class name conflicts, you can exclude minifuture safely. Example for Gradle:

implementation('io.github.centrifugal:centrifuge-java:{version}') {    exclude group: 'net.sourceforge.streamsupport', module: 'streamsupport-minifuture'}

Javadoc online

http://www.javadoc.io/doc/io.github.centrifugal/centrifuge-java

Obfuscation with ProGuard

Centrifuge-java library uses Protobuf library (Lite version) for client protocol. This fact and the fact that Protobuf Lite uses reflection internally can cause connection errors when releasing your application with Android shrinking and obfuscation features enabled. Seeprotocolbuffers/protobuf#6463 for details. To deal with this centrifuge-java comes with Proguard rulesincluded in the jar.

More informationabout Android shrinking.

Basic usage

See example code inconsole Java example or indemo Android app

To use with Android don't forget to set INTERNET permission toAndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET" />

Usage in background

When a mobile application goes to the background there are OS-specific limitations for established persistent connections - which can be silently closed shortly. Thus in most cases you need to disconnect from a server when app moves to the background and connect again when app goes to the foreground.

CI status

Build Status

License

Library is available under the MIT license. See LICENSE for details.

For Contributors

This section contains an information for library contributors. You don't need generating protobuf code if you just want to usecentrifuge-java in your project.

Generate proto

The protobuf definitions are located incentrifuge/main/proto directory.Protocol class is generated automatically during project compilation byprotobuf gradle plugin.

Check API signatures

We usemetalava-gradle to ensure we are aware of breaking API changes in the library.

All PRs check API signatures for compatibility. If you see an error, it may indicate there is a breaking change.Regenerate API signature with the following command and include an updatedapi.txt in your PR:

./gradlew :centrifuge:metalavaGenerateSignature

Also indicate a breaking change in changelog.

To verify API compatibility locally, run the following command:

./gradlew :centrifuge:metalavaCheckCompatibility

For maintainer

Automatic publishing

  1. Bump version inpublish-setup.gradle.
  2. Create new library tag.

The release GitHub Action should now publish the library.

Manual publishing

Do all steps from the automatic publishing. Create configuration filegradle.properties inGRADLE_USER_HOME:

signing.keyId=<LAST_8_SYMBOLS_OF_KEY_ID>signing.password=<PASSWORD>signing.secretKeyRingFile=/Path/to/.gnupg/secring.gpgmavenCentralUsername=<USERNAME>mavenCentralPassword=<PASSWORD>

Then run:

./gradlew publish --no-daemon --no-parallel./gradlew closeAndReleaseRepository

The second command will promote staged release to production on MavenCentral.

You can do it manually by following the instructions:

https://central.sonatype.org/pages/releasing-the-deployment.html

I.e.

  1. Login here:https://oss.sonatype.org/
  2. Go toStaging repositories
  3. Find release, pushClose button, wait
  4. PushRelease button

Special thanks

About

General Java and Android client SDK for bidirectional communication with Centrifugo and Centrifuge-based server over WebSocket

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp