Files
BridgeSwarm/examples/sdk-demo/index.html
T
Raven Scott e801bc0041 Refactor examples into per-app directories with separate HTML, CSS, and JS
- Give each example its own directory: chat/, whiteboard/, sdk-demo/, hrpc-demo/, data-demo/, screenshare/
- Split each into index.html, style.css, and app.js (no inline script/style; CSP-friendly)
- Remove old flat files (e.g. chat.html, whiteboard.html, whiteboard.js)
- Update README, examples/README, and docs/HRPC to use new paths
2026-02-12 07:35:18 -05:00

54 lines
2.0 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>BridgeSwarm SDK Demo</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>BridgeSwarm SDK Demo</h1>
<p>This page demonstrates all SDK features: swarm, connections, raw messages, and Protomux. Open in two tabs (or two devices) and join the same topic.</p>
<div class="section">
<h2>1. Swarm <span class="badge">join / leave / destroy</span></h2>
<p id="status" class="status">Waiting for extension…</p>
<div class="row">
<input type="text" id="topic" placeholder="Topic (32 bytes or string)" value="bridge-swarm-sdk-demo">
<button class="primary" id="btnJoin">Join topic</button>
<button class="danger" id="btnLeave" disabled>Leave & destroy</button>
</div>
</div>
<div class="section">
<h2>2. Connections <span class="badge">peerInfo, connection events</span></h2>
<p id="peers">Peers: 0</p>
<p class="status ok" id="connStatus" style="display:none;">On connection you get (conn, peerInfo). peerInfo: publicKey (hex), topics (hex[]).</p>
</div>
<div class="section">
<h2>3. Raw messages <span class="badge">conn.write / on('data')</span></h2>
<div class="row">
<input type="text" id="rawMsg" placeholder="Send raw bytes (text)…" disabled>
<button class="secondary" id="btnRawSend" disabled>Send raw</button>
</div>
</div>
<div class="section">
<h2>4. Protomux <span class="badge">createProtomux, channel, c.string / c.binary</span></h2>
<div class="row">
<input type="text" id="protoMsg" placeholder="Send via Protomux (string)…" disabled>
<button class="secondary" id="btnProtoSend" disabled>Send Protomux</button>
</div>
<p class="status ok" id="protoStatus" style="display:none;">Channel protocol: sdk-demo/v1. Binary messages supported too.</p>
</div>
<div class="section">
<h2>Log</h2>
<div class="log" id="log"></div>
</div>
<script src="app.js"></script>
</body>
</html>