DariInterceptor API
Interface and default implementation for capturing bridge messages
Interface
DefaultDariInterceptor
The built-in implementation. Stores messages in Dari's Room database and posts notifications.
The optional tag labels messages by bridge source when multiple interceptors are active in the same app.
Methods
onWebToAppRequest
Called when JavaScript sends a message to the native side.
| Parameter | Type | Description |
|---|---|---|
handlerName | String | Bridge handler name |
requestId | String? | Unique ID for pairing with a response. null = standalone |
requestData | String? | Request payload |
fireAndForget | Boolean? | null = use global config, true = resolve immediately, false = wait for response |
onWebToAppResponse
Called when the native side sends a response back to JavaScript.
| Parameter | Type | Description |
|---|---|---|
handlerName | String | Must match the request |
requestId | String? | Must match the request's requestId |
responseData | String? | Response payload |
isSuccess | Boolean | true → SUCCESS, false → ERROR |
onAppToWebRequest
Called when the native side pushes a message to JavaScript.
onAppToWebResponse
Called when JavaScript responds to a native-initiated message.
Fire-and-Forget
One-way calls that never receive a response can be marked so they immediately resolve to SUCCESS: