Handle network loss explicitly in the Flutter application while observing SPLive socket and media connection streams.
Observe the Rust socket
dart
sdk.socketStates.listen((state) {
print('Rust socket state: $state');
});Observe LiveKit media
dart
sdk.connectionStates.listen((state) {
print('Media state: $state');
});Reconnect flow
dart
Future<void> reconnectRoom() async {
await sdk.disconnectRoomSocket();
await sdk.disconnect();
await sdk.connectRoomSocket(
roomId: roomId,
userId: userId,
username: username,
);
await sdk.connect(mediaConfig);
}Idempotency
Use client-generated IDs for financial operations, gifts, and persistent messages so retries cannot create duplicate charges or records.
The current SDK does not provide a durable offline queue. Implement queueing in the application if your product requires offline message submission.