SocketRecorder

class SocketRecorder(redaction: RedactionEngine, store: SocketStore, enabled: Boolean = true, clock: () -> Long = System::currentTimeMillis)

Manual socket capture API. Every method is fail-open so host socket behavior remains isolated. When enabled is false, every method returns immediately without redacting or touching store.

One small function per socket lifecycle/frame event type plus the session-binding helpers; splitting further would fragment one cohesive fail-open recording boundary.

Constructors

Link copied to clipboard
constructor(redaction: RedactionEngine, store: SocketStore, enabled: Boolean = true, clock: () -> Long = System::currentTimeMillis)
constructor(redaction: RedactionEngine, store: SocketStore, enabled: Boolean, clock: () -> Long, binaryPreviewPolicy: BinaryPreviewPolicy)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The protocol this recorder stamps onto every connection it opens. See withProtocol.

Functions

Link copied to clipboard

Freezes the current app-run for delayed listener callbacks.

Link copied to clipboard
fun onBinaryMessage(connectionId: String, direction: SocketDirection, bytes: ByteArray, contentType: String? = null)
fun onBinaryMessage(connectionId: String, direction: SocketDirection, length: Long, contentType: String? = null)
Link copied to clipboard
fun onClosed(connectionId: String, failed: Boolean = false, error: String? = null)
Link copied to clipboard
fun onClosing(connectionId: String, code: Int? = null, reason: String? = null)
Link copied to clipboard
fun onCreated(connectionId: String, url: String, reconnectAttempt: Int = 0)
Link copied to clipboard
fun onFailure(connectionId: String, error: Throwable)
Link copied to clipboard
fun onMessage(connectionId: String, direction: SocketDirection, text: String, contentType: String? = null)
Link copied to clipboard
fun onOpen(connectionId: String, url: String, reconnectAttempt: Int = 0)
Link copied to clipboard
fun onPing(connectionId: String, direction: SocketDirection, bytes: ByteArray = ByteArray(0))
Link copied to clipboard
fun onPong(connectionId: String, direction: SocketDirection, bytes: ByteArray = ByteArray(0))
Link copied to clipboard
Link copied to clipboard

Returns a configured COPY stamped with protocol -- built the same way bindToCurrentSession builds one -- so the facade can hand the same base recorder instance to both a WebSocket and an MQTT adapter without either mutating the other's protocol.

Link copied to clipboard

Apply-style, matching withSessionIdProvider/withOperationLock. Fail-open: see canRecord.

Link copied to clipboard