Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions examples/src/bin/move_box_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,24 @@ fn on_connecting(
trigger: Trigger<OnAdd, SessionEndpoint>,
names: Query<&Name>,
mut ui_state: ResMut<GlobalUi>,
mut commands: Commands,
) {
let entity = trigger.target();
let name = names
.get(entity)
.expect("our session entity should have a name");
ui_state.log.push(format!("{name} connecting"));

// IMPORTANT
//
// Make sure to insert this component into your client entity,
// so that `aeronet_replicon` knows you want to use this for `bevy_replicon`!
//
// You can also do this when `spawn`ing the entity instead, which is a bit more
// efficient. We just do it on `OnAdd, SessionEndpoint`, since we have
// multiple `spawn` calls, and it's nicer to centralize inserting this
// component in a single place.
commands.entity(entity).insert(AeronetRepliconClient);
}

fn on_connected(
Expand Down Expand Up @@ -245,7 +257,7 @@ fn web_transport_ui(
global_ui.session_id += 1;
let name = format!("{}. {target}", global_ui.session_id);
commands
.spawn((Name::new(name), AeronetRepliconClient))
.spawn(Name::new(name))
.queue(WebTransportClient::connect(config, target));
}
});
Expand Down Expand Up @@ -341,7 +353,7 @@ fn web_socket_ui(
global_ui.session_id += 1;
let name = format!("{}. {target}", global_ui.session_id);
commands
.spawn((Name::new(name), AeronetRepliconClient))
.spawn(Name::new(name))
.queue(WebSocketClient::connect(config, target));
}
});
Expand Down
10 changes: 9 additions & 1 deletion examples/src/bin/move_box_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,15 @@ fn open_web_transport_server(mut commands: Commands, args: Res<Args>) {

let config = web_transport_config(identity, &args);
let server = commands
.spawn((Name::new("WebTransport Server"), AeronetRepliconServer))
.spawn((
Name::new("WebTransport Server"),
//
// IMPORTANT
// make sure to insert this component into your server entity,
// so that `aeronet_replicon` knows you want to use this for `bevy_replicon`!
//
AeronetRepliconServer,
))
.queue(WebTransportServer::open(config))
.id();
info!("Opening WebTransport server {server}");
Expand Down