Reference

Interface reference

One interface, every language. The driver handles discovery, connections, background, and power behind the scenes, so the code you write is nearly the same whichever language you're in. Pick yours; every example below switches with you.

Illustrative, not the current API. Do not copy these into a build.The snippets below sketch the SHAPE each flow is heading toward; they are not generated from the shipped surface and the names and types differ from it today (the real entry points arehop_node_open, hop_send_to, hop_poll_inbox and friends). For code that compiles, read the C ABI in sdk/hop.h and the wrapper for your language under sdk/. Generating this page from that header per release is the fix, and it is not done yet. Objective-C and Java have no binding package at all; those tabs are planned, not shipped.

Open a node

Open a node from your 32-byte secret. The driver owns key storage and the radios, you just hand it the key, and the secret is the address.

let node = HopNode::open(secret)?;
let node = try HopNode(secret: secret)
HopNode *node = [HopNode openWithSecret:secret error:&err];
val node = HopNode.open(secret)
HopNode node = HopNode.open(secret);

Send to a device

Address a sealed payload to another device by its public key. You don't pick a route or a bearer, the driver relays it across whatever it has.

node.send(Destination::device(peer), Payload::message("on my way"))?;
try node.send(to: .device(peer), payload: .message("on my way"))
[node sendTo:[Destination device:peer] payload:[Payload message:@"on my way"] error:&err];
node.send(Destination.device(peer), Payload.message("on my way"))
node.send(Destination.device(peer), Payload.message("on my way"));

Reach the internet from offline

Egress is a hops:// service request addressed to an endpoint node by its key: it fetches the URL and the sealed response routes back to your key. You still pick no route or bearer.

node.send_service_request(endpoint, "http", "get", b"hops://example.com/status")?;
try node.sendServiceRequest(to: endpoint, service: "http", method: "get", args: "hops://example.com/status")
[node sendServiceRequestTo:endpoint service:@"http" method:@"get" args:@"hops://example.com/status" error:&err];
node.sendServiceRequest(endpoint, "http", "get", "hops://example.com/status")
node.sendServiceRequest(endpoint, "http", "get", "hops://example.com/status");

Receive

Drain your inbox of sealed bundles addressed to you, and open them. Delivery acknowledgements and dedup are handled for you.

for msg in node.receive()? { handle(msg.open()?); }
for msg in try node.receive() { handle(try msg.open()) }
for (Message *msg in [node receiveAndReturnError:&err]) handle([msg openAndReturnError:&err]);
for (msg in node.receive()) handle(msg.open())
for (Message msg : node.receive()) handle(msg.open());

Subscribe to a topic

Join a pub/sub topic and receive whatever is published to it across the mesh, one-to-many, region-aware, the same on every platform.

node.subscribe("alerts/region-4")?;
try node.subscribe("alerts/region-4")
[node subscribe:@"alerts/region-4" error:&err];
node.subscribe("alerts/region-4")
node.subscribe("alerts/region-4");

Where this goes next

This is the shared, flow-level interface, the part that's the same everywhere. The full per-language reference (rustdoc, Swift DocC, Kotlin/Java Dokka) is generated per release from the same interface and linked here as it lands. Building on a platform that isn't here yet?Tell us.