Skip to main content
This page covers optional settings and public APIs for the main-process @flashcatcloud/electron-sdk. The renderer uses the Browser SDK; see Web SDK advanced configuration for its general options.

Initialization options

main.ts
init() returns false when validation fails. The SDK prints the reason in the main-process console and does not start collection, but it does not prevent the application from starting.

Custom upload endpoints

By default, the main process uploads regular RUM events to Flashduty SaaS. You do not need to set site or proxy.

Use a self-hosted intake host

If your intake supports HTTPS and receives events at /api/v2/rum, set its host in site. Do not include https:// or a path:
main.ts
The SDK uploads regular RUM events to https://rum.example.internal/api/v2/rum.

Use a custom forwarding endpoint

Use proxy when:
  • The intake only supports HTTP.
  • The upload path is not /api/v2/rum.
  • Clients must access the intake through a shared gateway.
main.ts
In this configuration, proxy is a RUM forwarding endpoint that you provide, not an operating-system or Electron network proxy. The main process adds the target path to the request. Your forwarding service must preserve the request body and DD-API-KEY header and send the request to the Flashduty intake. After you set proxy, the main process no longer uses site to build the upload URL.

Configure a self-hosted Session Replay endpoint

Regular RUM events go through the main process, but the renderer uploads Session Replay directly. As a result, the main-process site or proxy does not apply to replay segments. For self-hosted Session Replay, set the Browser SDK proxy in the renderer:
renderer.ts
Also add this endpoint to the page CSP connect-src directive.

Upload batching and frequency

The main process writes regular RUM events to the application’s userData directory before uploading them in batches. A batch is deleted only after a successful upload. During integration testing, use batchSize: 'SMALL' and uploadFrequency: 'FREQUENT' to see events sooner. Keep the defaults for normal operation.
Disk buffering and retry apply only to regular RUM events. The renderer uploads Session Replay directly, so replay does not use the main-process disk buffer.

Collect third-party pages

The current window’s page can always use the bridge; you do not need to set allowedWebViewHosts for it. Add hosts only when you want to collect a third-party page loaded in a <webview> or BrowserView:
main.ts
Matching includes subdomains. For example, allowing example.com also allows app.example.com.

Identify the signed-in user

After sign-in, call setUser() in the main process. Main-process events and bridged renderer events will carry the same user identity.
main.ts
When Session Replay is enabled, also call flashcatRum.setUser() and flashcatRum.clearUser() in the renderer as part of the same sign-in and sign-out flow, because replay segments bypass the main process.

Report handled errors

An exception caught by try/catch in the main process is not reported as an unhandled error. Call addError() to record it:
main.ts
Manually reported errors are marked as handled. Use properties in context to filter and identify the business workflow.

End the current session

Call stopSession() when a user signs out or when you need to start a new session:
main.ts
The current session ends immediately. The next valid UI input creates a new session.

Performance metrics for pre-created windows

Electron applications can create a hidden BrowserWindow, load its page, and show it later. By default, the SDK rebases FCP and LCP on the first time the window becomes visible so the pre-warm delay is not counted as page performance. To keep the raw document Paint Timing values, disable correction:
main.ts
This correction applies only to BrowserWindow. It does not correct metrics from WebContentsView or <webview>.

Customize error stack paths

By default, the SDK rewrites stack paths under the application directory to app:///<relative path>, allowing one source map upload to match installations on different machines. Most applications do not need to change this behavior. If your build output layout does not match the application directory, use normalizeStackPath:
main.ts
When the callback returns undefined, the SDK applies its default normalization. See Electron error symbolication for upload instructions.

SDK integration

Instrument the main and renderer processes.

Error symbolication

Upload JavaScript source maps and native crash symbols.

Data collection

Review collected data types and upload behavior.

Troubleshooting

Diagnose bridge, replay, and upload issues.