- BillingProvider connects to WebSocket on mount
- Subscribes to channel: workspace:{workspaceId}:entitlements
- When entitlements change (plan upgrade, usage limit hit, feature toggled), Nozle publishes to the channel
- React hooks (useCan, usePlan) update automatically — no polling
- Requests a WebSocket auth token from
GET /api/v1/auth/ws-token - Connects to the WebSocket
- Subscribes to the entitlements channel
- Updates the billing store on incoming messages
- Customer upgrades/downgrades plan
- Usage counter crosses a limit threshold
- Admin toggles a feature
- Subscription is cancelled or expired
centrifugoUrl is not provided, the React SDK falls back to REST-only mode. Hooks will fetch data on mount but won’t receive live updates. For most apps, this is fine for non-critical UI. For real-time gates (e.g., locking a feature the moment a limit is hit), WebSocket mode is recommended.