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

Implement RPCs with responses #253

Open
philpax opened this issue Mar 24, 2023 · 0 comments
Open

Implement RPCs with responses #253

philpax opened this issue Mar 24, 2023 · 0 comments
Labels
enhancement New feature or request topic:api API functionality, including both host and guest

Comments

@philpax
Copy link
Contributor

philpax commented Mar 24, 2023

#240 allows for one-way messages, but we should support RPCs with responses:

[messages.hello]
name = "Hello"
description = "Sent when a client joins the server, then sent back from the server"
fields = { text = "String", source_reliable = "Bool" }
return = "String"

Implementor's side:

#[rpc(messages::Hello)]
fn hello(text: String, source_reliable: bool) -> String {
  format!("{text} {source_reliable}")
}

Guest side:

async fn main() {
  let response = messages::Hello::call(Target::NetworkReliable, "Hello world!", true).await;
  println!("{response}");
}
@philpax philpax added enhancement New feature or request topic:api API functionality, including both host and guest labels Mar 24, 2023
@philpax philpax self-assigned this Mar 24, 2023
@philpax philpax removed their assignment Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request topic:api API functionality, including both host and guest
Projects
None yet
Development

No branches or pull requests

1 participant