Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

tel.schich:libdatachannel-java

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tel.schich:libdatachannel-java

libdatachannel-java is a binding to the libdatachannel that feels native to Java developers.

Source
mavenMaven Central
Version
0.24.1.1
Version published
Maintainers
2
Source

libdatachannel-java

License: MPL 2.0

Java wrappers for libdatachannel, a WebRTC Data Channels standalone implementation in C++.

Usage

Gradle (build.gradle.kts)

implementation("tel.schich:libdatachannel-java:0.24.1.0")

Maven (pom.xml)

<dependency>
    <groupId>tel.schich</groupId>
    <artifactId>libdatachannel-java</artifactId>
    <version>0.24.1.0</version>
</dependency>

Additionally, pull the architecture-specific native components using their the architecture-specific classifier.

Alternatively, use the libdatachannel-java-arch-detect module, which includes common architectures and has code to detect which one to apply.

Offerer example

var cfg = RTCConfiguration.of("stun.l.google.com:19302");
// try with resources to cleanup peer when done
try (var peer = RTCPeerConnection.createPeer(cfg)) {
    // when complete send sdp to remote peer
    peer.onGatheringStateChange((pc, state) -> {
        if (RTC_GATHERING_COMPLETE == state) {
            var sdp = pc.localDescription();
            System.out.println(sdp);
        }
    });
    // create data channel
    var channel = peer.createDataChannel("test");
    // wait for local sdp...
    // then set answer from remote peer
    peer.setAnswer(readInput());
    // register message callback
    channel.onMessage((c, message, size) -> System.out.println("Incoming message: " + new String(message)));
    // block until channel is closed
    CompletableFuture<Void> future = new CompletableFuture<>();
    channel.onClose(c -> future.completeAsync(() -> null));
    future.join();
}

Android

For Android apps an additional module exists: libdatachannel-java-android, which has an Android archive (.aar file) as its main artifact. This artifact contains the native components in the correct file layouts, such that the library works without any additional initialization code. The arch-detect module will not work on Android without changes!

Permissions

To use libdatachannel on Android, the following permissions are required:

  • android.permission.INTERNET

Examples

See tests for more examples

FAQs

Package last updated on 06 Feb 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts