Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update protocol to v15 #394

Merged
merged 15 commits into from
Aug 20, 2024
Merged

Update protocol to v15 #394

merged 15 commits into from
Aug 20, 2024

Conversation

nbsp
Copy link
Member

@nbsp nbsp commented Aug 16, 2024

exported as LocalTrackSubscribed in the client and FFI.

at the moment the SFU assumes Rust doesn't accept TrackSubscribed so it doesn't send it: see livekit/livekit#2939

@davidzhao
Copy link
Member

Currently Rust stack is on protocol version 9. part of this update will require bringing it to 10+. and I think we should just bring it up to date to support protocol 15.

Here are the changes required (JS PRs)

exported as LocalTrackSubscribed in the client and FFI.
@nbsp nbsp force-pushed the nbsp/add/tracksubscribe branch from 9d7ba47 to 739c00e Compare August 16, 2024 23:16
@nbsp
Copy link
Member Author

nbsp commented Aug 16, 2024

v10 through v13 added or already there. re: RequestResponse: we don't keep a list of pending requests and we don't care about arbitrary responses at all -- most of our signal_client requests go to _. should i add it regardless and make it no-op?

@davidzhao
Copy link
Member

v10 through v13 added or already there. re: RequestResponse: we don't keep a list of pending requests and we don't care about arbitrary responses at all -- most of our signal_client requests go to _. should i add it regardless and make it no-op?

yeah no-op is fine. we can add the capability later of firing error responses for things, but not required to be protocol-compatible.

@nbsp nbsp force-pushed the nbsp/add/tracksubscribe branch from 739c00e to dd5fe53 Compare August 16, 2024 23:47
Copy link
Member

@davidzhao davidzhao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice work! Just a couple of things:

  1. see inline about handling action
  2. the streamID change is a bit tricky and we would need to test e2e to be sure. the way to test is creating a room with sync-stream enabled:
  • lk room create --name <myroom> --sync-streams
  • then starting a publisher immediately: lk load-test --room <myroom> --publishers 1 --audio-publishers 1
  • then join the room with Rust and ensure both streams are retrieved correctly

@@ -778,8 +798,8 @@ impl SessionInner {
async fn simulate_scenario(&self, scenario: SimulateScenario) -> EngineResult<()> {
let simulate_leave = || {
self.on_signal_event(proto::signal_response::Message::Leave(proto::LeaveRequest {
action: proto::leave_request::Action::Reconnect.into(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it doesn't look like this is handled? this would determine if a client should reconnect vs disconnect for good.

Copy link
Member Author

@nbsp nbsp Aug 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from what i've seen rust-sdks reconnection logic is fundamentally different, and doesn't use LeaveRequest for retrying at all? it attempts to restart the publisher, or completely closing it (with Action::Disconnect) then reconnecting and recovering? i'll see if i can make it consistent with JS

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the key here is if server is not sending a reconnect action, Rust should not attempt to reconnect. CC: @theomonnom

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also can confirm streams are received and handled correctly

@nbsp nbsp force-pushed the nbsp/add/tracksubscribe branch from d4349fc to df2392c Compare August 19, 2024 19:23
@nbsp nbsp force-pushed the nbsp/add/tracksubscribe branch from df2392c to ad4baad Compare August 19, 2024 21:34
@nbsp nbsp requested a review from davidzhao August 19, 2024 21:34
Copy link
Member

@theomonnom theomonnom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

otherwise lgtm

Copy link
Member

@theomonnom theomonnom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nvm, seems like it is still not returning an Error when receiving a bad RequestResponse.

(e.g update_metadata, ..)

@nbsp nbsp requested a review from theomonnom August 20, 2024 00:10
@nbsp nbsp requested a review from theomonnom August 20, 2024 03:31
@nbsp nbsp force-pushed the nbsp/add/tracksubscribe branch from 0c7c83a to 00583a8 Compare August 20, 2024 05:45
@nbsp nbsp requested a review from lukasIO August 20, 2024 16:41
@@ -69,6 +69,8 @@ pub enum RoomError {
TrackAlreadyPublished,
#[error("already closed")]
AlreadyClosed,
#[error("request error: {}", .0.message)]
Request(proto::RequestResponse),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you recreate another struct, basically having the same fields of the RequestResponse but removing the internal fields like the request_id

_ => Err(RoomError::Request(response)),
}
} else {
log::error!("could not receive response for set_metadata request");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logs aren't useful if we're already returning an error

.await;
Ok(())
if let Ok(response) = timeout(REQUEST_TIMEOUT, {
let request_id = self.inner.rtc_engine.session().signal_client().request_id();
Copy link
Member

@theomonnom theomonnom Aug 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be moved to the Room impl? request_id doesn't necessarily needs to be on the signal client?
Also making it more explicit like "new_request_id"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the JS SDK puts it in the signal client, but it's a bit more cumbersome here, yeah
we can maybe move it to RtcEngine?

Copy link
Member

@theomonnom theomonnom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm otherwise

@nbsp nbsp changed the title Add support for TrackSubscribed Update protocol to v15 Aug 20, 2024
@nbsp nbsp merged commit 1abf092 into main Aug 20, 2024
11 of 17 checks passed
@nbsp nbsp deleted the nbsp/add/tracksubscribe branch August 20, 2024 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants