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

Add support for client-writable signals #6

Open
tqwewe opened this issue Jul 18, 2023 · 2 comments
Open

Add support for client-writable signals #6

tqwewe opened this issue Jul 18, 2023 · 2 comments

Comments

@tqwewe
Copy link
Owner

tqwewe commented Jul 18, 2023

Currently, server signals are read only on the client, and cannot be updated other than by the server.

It would be nice to have writable signals from the client.

I assume this would involve a similar API to the server_fn macro, with a mpsc sender and receiver:

#[server_signal(Counter)]
pub async fn counter(count: i32, tx: Sender<i32>, mut rx: Receiver<i32>) -> Result<(), ServerFnError> {
    while let Some(new_count) = rx.receive().await? {
        println!("new count is {new_count}");
        tx.send(new_count + 1).await?;
    }
    
    Ok(())
}
@Boscop
Copy link

Boscop commented Sep 29, 2024

@tqwewe Yes, please! 🙏
It would be very useful to have a separate kind of signal that notifies the server of changes on the client side (from UI controls).
Have you looked into this more? 🙂

@tqwewe
Copy link
Owner Author

tqwewe commented Sep 29, 2024

@Boscop I haven't had a need for this in any of my projects yet, so haven't taken the time to look into it. If I do need it, I certainly will implement it, but sadly don't have the time to implement it currently. PRs are absolutely welcome for this if anyone wants to give it a shot.

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

No branches or pull requests

2 participants