Skip to main content
Optimize your Fanfare integration for fast load times and responsive user experiences.

SDK Initialization

Lazy Loading

Initialize the SDK only when needed to reduce initial page load time.

Early Initialization for Critical Paths

For pages where users will definitely enter an experience, initialize early.

Network Optimization

Connection Pooling

The SDK maintains persistent connections for real-time updates. Avoid creating multiple client instances.

Handling Rate Limits

The API returns rate limit headers to help you optimize request patterns.

Caching Strategies

Experience Details

Cache experience details to avoid redundant API calls.

Session State

The SDK maintains session state internally. Access it without additional API calls.

Real-Time Updates

Efficient Event Handling

Subscribe only to events you need.

Debounce UI Updates

For rapidly changing data like queue position, debounce UI updates.

Bundle Size

Tree Shaking

Import only the modules you need.

Code Splitting

Split Fanfare-related code into separate chunks.

Monitoring Performance

SDK Metrics

The SDK provides performance metrics for monitoring.
Track these metrics in your application:

Production Checklist

Use live keys (pk_live_, sk_live_) in production, not test keys.
Wrap Fanfare components in error boundaries to prevent crashes from affecting your entire application.
Set up monitoring for SDK performance metrics and error rates.
Run load tests to verify performance under expected traffic conditions.

Next Steps