NfcRelayTransport

Pluggable WebSocket transport for the v3 NFC relay session.

Implement this interface using your preferred WebSocket library (e.g. OkHttp) and pass it to ro.eidkit.sdk.EidKit.relay. The SDK calls sendFrame to send JSON frames and delivers incoming frames via the onFrame callback set during connect.

The SDK guarantees:

  • connect is called once before any sendFrame call.

  • close is called exactly once, after the relay completes or on error.

  • All calls from the SDK arrive on a background dispatcher (Dispatchers.IO).

Functions

Link copied to clipboard
abstract fun close()

Close the connection. Idempotent — may be called multiple times.

Link copied to clipboard
abstract suspend fun connect(url: String, onFrame: (String) -> Unit)

Open the WebSocket connection to url. Must block (or suspend) until the connection is established and ready to send frames.

Link copied to clipboard
abstract fun sendFrame(json: String)

Send a JSON text frame. Called from the SDK on a background thread. Must not block for more than a few milliseconds — actual delivery is async.