DevToolsMiddleware

class DevToolsMiddleware(config: DevToolsConfig, scope: CoroutineScope, stateSerializers: SerializersModule? = null)(source)

Middleware for connecting Reaktiv store to DevTools server.

This class is typically instantiated internally by DevToolsModule. Use DevToolsModule directly for the simplest setup:

val introspectionConfig = IntrospectionConfig(platform = "Android")
val sessionCapture = SessionCapture()

val store = createStore {
module(IntrospectionModule(introspectionConfig, sessionCapture))
module(DevToolsModule(
config = DevToolsConfig(
introspectionConfig = introspectionConfig,
serverUrl = "ws://192.168.1.100:8080/ws"
),
scope = lifecycleScope,
sessionCapture = sessionCapture
))
// ... other modules
}

The middleware intercepts all actions and:

  • Handles DevToolsAction (Connect, Disconnect, Reconnect)

  • Broadcasts other actions to the DevTools server when connected

Parameters

config

DevTools configuration

scope

CoroutineScope for async operations

stateSerializers

Optional SerializersModule. If not provided, will use Store's serializers

Constructors

Link copied to clipboard
constructor(config: DevToolsConfig, scope: CoroutineScope, stateSerializers: SerializersModule? = null)

Properties

Link copied to clipboard
val currentRole: StateFlow<ClientRole>
Link copied to clipboard

The middleware function to be used with Reaktiv store.

Functions

Link copied to clipboard
fun cleanup()

Cleans up resources including the logic tracing observer. Note: SessionCapture cleanup should be done via DevToolsLogic.cleanup()

Link copied to clipboard
suspend fun disconnect()

Disconnects from the DevTools server.