Skip to content

Commit fce3252

Browse files
Add support for RPC V2 (#1087)
See this pull request for more info about what this does and how rpc v2 works: livekit/client-sdk-js#1832 Also, for an in depth description of behavior in edge cases, see [RPC_SPEC.md here](https://github.com/livekit/client-sdk-js/blob/00e93de0c3d85f846fa6707749fa46457a653a29/RPC_SPEC.md). > [!WARNING] > This pull request was LLM generated and has only been lightly reviewed by the author, who is not a flutter expert. I have tested this and can confirm it works in the happy path, but no other validation has been done. > > A more thorough review of this needs to occur before it could be merged. --------- Co-authored-by: Hiroshi Horie <548776+hiroshihorie@users.noreply.github.com>
1 parent 6bdbc3e commit fce3252

18 files changed

Lines changed: 2252 additions & 257 deletions

.changes/add-rpc-v2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
minor type="added" "Add RPC v2 (data-stream-based payloads) with v1 fallback"

example/lib/widgets/controls.dart

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import 'package:livekit_client/livekit_client.dart';
1010
import 'package:flutter_webrtc/flutter_webrtc.dart';
1111

1212
import '../exts.dart';
13+
import 'rpc_test_sheet.dart';
1314

1415
class ControlsWidget extends StatefulWidget {
1516
//
@@ -38,6 +39,8 @@ class _ControlsWidgetState extends State<ControlsWidget> {
3839

3940
bool _speakerphoneOn = AudioManager.instance.isSpeakerOutputPreferred;
4041

42+
final _rpcController = RpcTestController();
43+
4144
@override
4245
void initState() {
4346
super.initState();
@@ -52,6 +55,7 @@ class _ControlsWidgetState extends State<ControlsWidget> {
5255
void dispose() {
5356
unawaited(_subscription?.cancel());
5457
participant.removeListener(_onChange);
58+
_rpcController.dispose();
5559
super.dispose();
5660
}
5761

@@ -459,8 +463,17 @@ class _ControlsWidgetState extends State<ControlsWidget> {
459463
icon: const Icon(Icons.bug_report),
460464
tooltip: 'Simulate scenario',
461465
),
466+
IconButton(
467+
onPressed: _onTapRpcTest,
468+
icon: const Icon(Icons.swap_horiz),
469+
tooltip: 'RPC test',
470+
),
462471
],
463472
),
464473
);
465474
}
475+
476+
void _onTapRpcTest() {
477+
unawaited(showRpcTestSheet(context, widget.room, _rpcController));
478+
}
466479
}

0 commit comments

Comments
 (0)