Skip to content

Getting Started ​

Connect your PC, Android, iOS, and Web devices in three steps.

1. Start the Hub ​

Download the prebuilt connekt-hub binary for macOS, Linux, or Windows from GitHub Releases:

  • connekt-hub — Full Hub with embedded PC Web Debugger (http://127.0.0.1:9527) and zero-install H5 Companion (/m).
  • connekt-hub-headless — Pure Sidecar binary without the Web UI (ideal for Electron, CLIs, and CI rigs).

Or build and run from source:

bash
git clone https://github.com/K0ST/Connekt.git
cd Connekt

make server           # Hub + Web Debugger (:9527) & H5 Companion (/m)
make server-headless  # Pure headless Sidecar

2. Connect a Device (Mobile & Web Peers) ​

Peer SDKs target the PC Hub (Target.PC / Target.pc) by default.

swift
// Package.swift:
// .package(url: "https://github.com/K0ST/Connekt.git", from: "0.1.0")
// Link `Connekt` in Debug and `ConnektNoOp` in Release.

import Connekt

// Start over USB (pass `{ $0.enableLan = true }` for Wi-Fi failover)
Connekt.start()

// 1. Message
Connekt.channel("telemetry").post("{\"fps\":60}")

// 2. Request / Response
let response = try await Connekt.channel("echo").request("ping")

// 3. Binary Stream
let stream = try await Connekt
    .channel("files")
    .openStream(meta: ["mime": "image/png"])
try await stream.writeFrom(fileURL: fileURL)
stream.close()
kotlin
// build.gradle.kts (Maven Central):
// debugImplementation("dev.mobra.connekt:connekt-sdk:0.1.0")
// releaseImplementation("dev.mobra.connekt:connekt-sdk-no-op:0.1.0")

import dev.mobra.connekt.Connekt

// Auto-initialized over ADB via ContentProvider!
// 1. Message
Connekt.channel("telemetry").post("""{"fps":60}""")

// 2. Request / Response
val response = Connekt.channel("echo").request("ping")

// 3. Binary Stream
Connekt.channel("files")
    .openStream(meta = mapOf("mime" to "image/png"))
    .use { stream ->
        stream.writeFrom(file.inputStream())
    }
ts
// npm install @connekt/client
// (or import directly from `/sdk/connekt-peer.js` served by connekt-hub)

import { Connekt, Target } from "@connekt/client/peer";

await Connekt.connect(); // auto-resolves ?hub=... or same-origin /ws

// 1. Message
Connekt.channel("telemetry").post("ready");

// 2. Request / Response
const response = await Connekt.channel("echo").request("ping");

// 3. Binary Stream
const stream = Connekt
  .channel("files")
  .openStream(Target.PC, { mime: file.type });
await stream.writeFromBlob(file);
stream.close();

3. Control from PC (Host SDKs) ​

Control SDKs always take an explicit target first: a single peer_id, a subset array [peerA, peerB], or "*" (Target.ALL).

ts
// npm install @connekt/client
import { spawnDaemon } from "@connekt/client/sidecar";

const daemon = await spawnDaemon({ binaryPath: "./connekt-hub" });
const { client } = daemon;

// 1. Multicast Message
await client.channel("notice").send([peerA, peerB], "sync");

// 2. Request / Response
const response = await client.channel("echo").request(peerA, "ping");

// 3. Binary Stream
const stream = client
  .channel("files")
  .openStream(peerA, { mime: "image/png" });
await stream.write(pngBytes);
stream.close();

await daemon.stop();
python
# pip install connekt
from connekt import spawn_daemon

with spawn_daemon(binary_path="./connekt-hub") as daemon:
    client = daemon.client

    # 1. Multicast Message
    client.channel("notice").send([peer_a, peer_b], "sync")

    # 2. Request / Response
    response = client.channel("echo").request(peer_a, "ping")

    # 3. Binary Stream
    with client.channel("files").open_stream(
        peer_a, {"mime": "image/png"}
    ) as stream:
        stream.write(png_bytes)
rust
// cargo add connekt-core
use std::time::Duration;
use connekt_core::{AdbConfig, ConnektHub, StreamMeta, UsbmuxConfig};

let hub = ConnektHub::builder()
    .with_adb(AdbConfig::default())
    .with_usbmux(UsbmuxConfig::default())
    .start()
    .await?;

// 1. Multicast Message
hub.channel("notice").send([peer_a, peer_b], "sync").await?;

// 2. Request / Response
let response = hub
    .channel("echo")
    .request(peer_a, "ping", Duration::from_secs(5))
    .await?;

// 3. Binary Stream
let meta = StreamMeta::from([("mime".into(), "image/png".into())]);
let stream = hub.channel("files").open_stream(peer_a, meta).await?;
stream.write(png_bytes).await?;
stream.close().await?;

Connecting to an already-running Hub

If connekt-hub is already running on :9527, skip spawnDaemon and connect directly:

  • TypeScript: await ConnektClient.connect({ baseUrl: "http://127.0.0.1:9527" })
  • Python: with ConnektClient("http://127.0.0.1:9527") as client:

Released under the MIT License.