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. |
| final remoteParticipant = _room.getParticipantByIdentity(destination); | ||
| final remoteProtocol = remoteParticipant?.clientProtocol ?? ClientProtocolVersion.v0.toIntValue(); | ||
| final useV2 = remoteProtocol >= ClientProtocolVersion.v1.toIntValue(); |
There was a problem hiding this comment.
thought: I wonder if it would be cleaner to make ClientProtocolVersion implement Comparable (this) to avoid all the toIntValue()s here?
| 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.
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.