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

Create a compelling example for the README #80

Closed
fitzgen opened this issue May 10, 2019 · 3 comments · Fixed by #87
Closed

Create a compelling example for the README #80

fitzgen opened this issue May 10, 2019 · 3 comments · Fixed by #87
Labels
docs Related to documentation and the guide enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@fitzgen
Copy link
Member

fitzgen commented May 10, 2019

We have a placeholder right now, but we should have something cool!

Ideally it would use multiple gloo crates (probably via gloo::whatever re-exports).

Maybe using timers and events? Suggestions welcome!

@fitzgen fitzgen added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels May 10, 2019
@fitzgen fitzgen added this to the 0.1 initial release milestone May 10, 2019
@fitzgen
Copy link
Member Author

fitzgen commented May 10, 2019

+cc @yoshuawuyts, master of tiny-but-compelling code snippets

@fitzgen fitzgen added the docs Related to documentation and the guide label May 10, 2019
@yoshuawuyts
Copy link
Collaborator

yoshuawuyts commented May 15, 2019

@fitzgen ohhh, hi!

I was thinking perhaps showing off the websocket capabilities might be fun:

use futures::prelude::*;
use futures::io::BufReader;
use gloo::WebSocket;

#[Derive(serde::Deserialize)]
struct Message {
    id: usize,
}

#[runtime::main]
async fn main() {
    let socket = WebSocket::connect("/ws").await;
    let socket = BufReader::new(socket);

    #[runtime::for_await]
    for string in socket.lines() {
        let msg = Message::parse(string);
        println!("message #{} received", msg.id);
    }
}

This is not quite feasible right now, but I think the interaction between Serde's structured serialization + composable abstractions over web APIs might make some things click for what Gloo is about! (:

@yoshuawuyts
Copy link
Collaborator

Oh, maybe this was too ambitious. It'd make for a really fun demo tho, haha. Perhaps logging to the console in a set loop gives a good idea of how things currently feel (:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Related to documentation and the guide enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants