5 Commits

Author SHA1 Message Date
4060f64b98 basic interactions work 2026-09-28 23:34:04 +06:00
b8d3a44d22 functionality updates 2026-09-15 17:13:32 +06:00
bd7ac94e74 Add CoAP request/response test suite over UDP
Exercises every route against a running server using the bundled client,
so the request/response path can be checked without the HTTP bridge.

Covers /hello with and without a name, percent- and plus-encoded query
values, text and JSON POST bodies, and the 4.00/4.04/4.05 error paths.
/health is matched by shape rather than an exact string since uptime
moves. Exits non-zero on failure; COAP_HOST/COAP_PORT retarget it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-07 11:45:03 +06:00
4906ca7652 Add HTTP bridge so the CoAP server can be checked in a browser
Browsers speak HTTP over TCP and cannot open coap:// URLs, which made the
server awkward to try without the CLI client. The bridge accepts an ordinary
HTTP request, reissues it as CoAP over UDP, and maps the response code back
onto an HTTP status (the raw code is also returned in X-Coap-Code).

It serves a test console at / with a name field and a button per route, so
GET, POST, 4.04 and 4.05 can all be exercised by clicking.

The CoAP request logic moves from src/bin/client.rs into src/lib.rs so the
client and the bridge share one implementation.

The bridge is a development convenience: a small HTTP/1.1 subset with no
keep-alive, chunked bodies or TLS.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-05 10:01:44 +06:00
137b9d9547 Add CoAP-over-UDP hello server in Rust
A minimal CoAP (RFC 7252) server built on coap-lite for message encoding
and a tokio UdpSocket for transport. The socket, read loop and routing are
kept in src/main.rs rather than behind a framework.

Routes:
  GET  /hello[?name=X]  -> 2.05 "Hello, X!" (defaults to World)
  POST /hello           -> 2.01, name from a raw text or JSON body
  GET  /health          -> 2.05 status + uptime

Unknown paths return 4.04, known paths with the wrong method 4.05.

Includes a CLI client (src/bin/client.rs) for smoke tests and unit tests
covering the greeting, payload parsing and query decoding. Verified against
node-coap as an independent implementation to confirm wire compatibility.

The earlier Node.js prototype is kept under nodejs/ for reference.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-03 10:28:24 +06:00