Documentation
¶
Overview ¶
duplex-mobile is the iOS and Android self-test of Tango's ipc streams: the duplex examples' services (package examples/duplex/services: Echo, Upload, Sink, Source, Bench.Report) behind an ipc.Router wired like examples/duplex, and a page (services/selftest.js) that exercises them and reports to Go, which logs one line per result.
bash mobile/ios/build.sh examples/duplex-mobile simulator GOFLAGS=-tags=tango_selftest bash mobile/android/build.sh examples/duplex-mobile
On Android the variables below come from the launch extra TANGO_TEST_ENV (tango_selftest builds, debuggable APK: am start ... --esa TANGO_TEST_ENV TANGO_SCHEME_PROBE=1,TANGO_SCHEME_SELFTEST=1; scripts/smoke.sh android-selftest). The Android lanes (down:android, up:android) are on by default; TANGO_IPC_LANES_ANDROID=0 turns them off.
With TANGO_SCHEME_PROBE=1 (simctl launch: SIMCTL_CHILD_TANGO_SCHEME_PROBE=1) the page opens as index.html?probe and runs the WebKit streaming probe instead: the iOS backend answers /__tango/probe/stream itself with 8 chunks of 1 KiB, 200 ms apart, and the page logs when each one arrived ("probe: {...}"); scripts/smoke.sh ios-probe judges it. TANGO_SCHEME_PROBE=1 also adds the scheme-handler test routes (/__test/..., package examples/duplex/services) and the ipc method Debug.Stats. With TANGO_SCHEME_SELFTEST=1 as well the page opens as index.html?selftest instead and runs the scheme-handler self-test: the request sequence of internal/platform/darwin's TestAsyncSchemeParity, checked against the expected answers, and an aborted never-ending stream whose Go handler must return, and the IPC fast lanes the page got (smoke.sh launches with TANGO_IPC_LANES_DARWIN=1, which turns them on: iOS lanes are off by default; on macOS, where up:post is on by default, the =1 changes nothing) and the lane scenarios of examples/duplex/services/lanetests.js ("selftest: {...}"; scripts/smoke.sh ios-selftest judges it). With TANGO_IPC_LANE_FAULT set too (a tango_dev or tango_selftest build, scripts/smoke.sh ios-lanefault: TANGO_IPC_LANE_FAULT=up:post:3) the page opens as index.html?selftest&lanefault and runs only the lane fault scenario ("lanefault: {...}"). With TANGO_DUPLEX_BENCH=1 the page opens as index.html?bench whatever the other variables say (it is checked first) and runs the duplex benchmark of /bench.js (package examples/duplex/services, the same code as go run ./examples/duplex -bench; "bench: {...}", docs/ipc-bench.md). TANGO_SCHEME_PROBE=1 may be added for Debug.Stats' up:post counters in the result (the benchmark verdict runs in docs/ipc-bench.md were made without it). On iOS and macOS, up:post is on by default and TANGO_IPC_LANES_DARWIN=0 gives the fallback configuration. It also runs on the desktop (go run ./examples/duplex-mobile).