DevToolsLogic

class DevToolsLogic(storeAccessor: StoreAccessor, config: DevToolsConfig, sessionCapture: SessionCapture? = null) : ModuleLogic(source)

Logic class for managing DevTools connection lifecycle.

The DevToolsMiddleware communicates with this logic to handle connection operations triggered by DevToolsAction dispatches.

Constructors

Link copied to clipboard
constructor(storeAccessor: StoreAccessor, config: DevToolsConfig, sessionCapture: SessionCapture? = null)

Functions

Link copied to clipboard
open suspend fun beforeReset()
Link copied to clipboard
fun cleanup()

Cleans up resources and stops session capture. Call this when the DevTools connection is no longer needed.

Link copied to clipboard
suspend fun connect(serverUrl: String, clientName: String? = null)

Connect to a DevTools server.

Link copied to clipboard
suspend fun disconnect()

Disconnect from the current DevTools server.

Link copied to clipboard

Exports the current session with crash information. Typically called by crash handlers.

Link copied to clipboard

Exports the current session as a JSON string for manual sharing. This can be imported later as a ghost device in the DevTools UI.

Link copied to clipboard

Get the current connection for direct access if needed.

Link copied to clipboard

Gets the session capture instance for session history sync.

Link copied to clipboard

Check if currently connected.

Link copied to clipboard
fun observeMessages(handler: suspend (DevToolsMessage) -> Unit)

Register a handler for incoming server messages.

Link copied to clipboard
suspend fun reconnect()

Reconnect to the last known server.

Link copied to clipboard
suspend fun send(message: DevToolsMessage)

Send a message through the current connection.