Add support for RPC V2#1087
Conversation
|
Caution Breaking change detected without major changeset
If this is intentional, please add a changeset with |
|
^ In the above "breaking change" warning, it looks like the issue is: But it's a field addition... That shouldn't be a breaking change? Let me know what I am missing - I could I think make this private, but I'd need to verify that is ok first. |
| E2EContainer? container; | ||
| late Room room; | ||
|
|
||
| group('rpc tests', () { | ||
| test('test rpc handler register', () async { | ||
| container = E2EContainer(); | ||
| room = container!.room; | ||
| await container!.connectRoom(); | ||
|
|
||
| room.registerRpcMethod('echo', (RpcInvocationData data) async { |
There was a problem hiding this comment.
question: Heads up that I kept all the old / pre-existing rpc v1 tests around. I'm not sure though if this is really still needed, because the new tests should be testing all the same paths. I'll defer to what others think here, I don't have a strong opinion on if they should be kept or removed.
This can be used to exercise sending / receiving rpc requests in the example app
…n livekit/protocol)
Add ClientProtocolVersion, and adds this to connectOptions. Just like the swift version, thie can be configured on connection for testing purposes.
xianshijing-lk
left a comment
There was a problem hiding this comment.
some nits / questions
| /// `ParticipantInfo.clientProtocol`. Drives the caller- and handler-side decision | ||
| /// between RPC v1 packets and RPC v2 data streams. Absent / unrecognized values | ||
| /// from older clients resolve to `0` (matches [ClientProtocolVersion.v0]). | ||
| int get clientProtocol => _participantInfo?.clientProtocol ?? ClientProtocolVersion.v0.toIntValue(); |
There was a problem hiding this comment.
Just want to make sure I understand, this _participantInfo is the remote participant info, right ?
| throw RpcError(code: RpcError.sendFailed, message: 'No local participant'); | ||
| } | ||
|
|
||
| final writer = await local.streamText(StreamTextOptions( |
There was a problem hiding this comment.
can you tell me where this streamText() is implemented ? local_participant.dart ?
Attach the RPC test controller to the active room instead of passing a room through each handler registration. Clear stale handlers when the sheet moves to another room, avoid registering against disposed rooms, and let handler card text use the theme's default text colors.
# Conflicts: # lib/src/participant/local.dart
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.
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.