Production Best Practices
Going from “it works on my machine” to “it works for all users, reliably” requires addressing security, reliability, performance, and monitoring. This guide covers the key areas.Authentication
Use JWT in production
Generate JWTs on your backend
Handle token refresh
One credential per user
Never share a Telephony Credential across multiple users. Each user must have their own JWT to ensure they receive their own incoming calls.Connection Management
One client instance per tab
Clean up on page unload
By default (hangupOnBeforeUnload: true), the SDK hangs up active calls and sends BYE on beforeunload:
hangupOnBeforeUnload: false to prevent the SDK from hanging up on unload. The SDK then flushes an intermediate call report on visibilitychange → hidden via keepalive so no call report data is lost:
When
hangupOnBeforeUnload: false, the SDK flushes a final call report on visibilitychange → hidden (the last reliably observable event on desktop and mobile) using keepalive so the report is not lost when the page tears down. Available since SDK v2.27.4.