https://linen.dev logo
Join Discord
Powered by
# tech
  • d

    dry-afternoon-92118

    05/08/2023, 3:22 PM
    Did you manage to get any API calls going? I didn't and I was kind of disappointed as it is the first thing I do with any framework - check how ergonomic communication with the backend is
  • m

    microscopic-island-86582

    05/08/2023, 3:25 PM
    Since it's all wasm for the web, could you use hyper to make calls to the backend?
  • a

    agreeable-painting-48846

    05/08/2023, 3:44 PM
    Looks like it just simply uses reqwest: https://github.com/DioxusLabs/dioxus/blob/master/examples/login_form.rs
  • m

    microscopic-island-86582

    05/08/2023, 3:50 PM
    That makes sense
  • a

    agreeable-painting-48846

    05/08/2023, 4:22 PM
    I mean I guess in that respect you could still just use hyper
  • c

    careful-iron-7275

    05/08/2023, 4:37 PM
    hyper doesn't really work with WASM (since it works on raw transport-layer streams; QUIC/HTTP3 really makes being technically correct a mouthful ), what you probably want is either reqwest (which uses the fetch API under the hood) or gloo-net, which is yet another ergonomic wrapper over the fetch API, but maintained by the WASM working group (probably a lil more lightweight than reqwest, but I haven't tested it yet)
  • b

    busy-vr-65076

    05/08/2023, 4:41 PM
    I used gloo-net in my NASA photo fetcher.
  • c

    careful-iron-7275

    05/08/2023, 4:45 PM
    Oh nice! Do you have any stats on its binary size?
  • b

    busy-vr-65076

    05/08/2023, 4:48 PM
    Ha! No, stuff like that is a bit beyond me at the moment. I also noticed that I'm using gloo_net in the "Yew re-vamp" of the office intranet site I made. I'm going to re-work the NASA photo app using Dioxus, so will look into this binary size stat as I do that.
  • a

    agreeable-painting-48846

    05/08/2023, 6:15 PM
    tbh I think reqwest is really the only viable one at the moment
  • a

    agreeable-painting-48846

    05/08/2023, 6:18 PM
    hyper is just the underlying tech for reqwest, ureq can't use async and I think gloonet looks like it's more for direct wasm stuff
  • c

    careful-iron-7275

    05/08/2023, 6:28 PM
    Yeah, reqwest is the only HTTP client I know of that works both on native and on WASM, but, personally, I would write a trait abstraction using the
    http
    crate types for libraries and for binary projects, well, most binary projects either run on native platforms or in WASM; it's rather rare that you need the compatibility in that area. I think alternative HTTP clients, even if they are built on hyper, too, are important. Each client has its own niche most of the time. reqwest, for example, isn't a client I personally would use to load data from unknown servers (on native platforms that is, on WASM it uses
    fetch
    which doesn't have this issue), because reqwest doesn't have a way to restrict the body size (https://github.com/seanmonstar/reqwest/issues/1234). That's fine for APIs where you trust the host you are connecting to but for, for example, crawlers? No thanks.
  • a

    agreeable-painting-48846

    05/08/2023, 6:30 PM
    Ah, yeah that's ture
  • m

    microscopic-island-86582

    05/09/2023, 2:46 PM
    I did't realize all the intricacies of these crates... Thanks for the info!
  • c

    cold-ambulance-26077

    05/21/2023, 8:22 PM
    https://queue.acm.org/detail.cfm?id=3595878
  • a

    agreeable-painting-48846

    05/21/2023, 9:03 PM
    and there it is peeps every single reason to use rust
  • l

    late-sandwich-93145

    05/24/2023, 5:02 PM
    Hiya, for my serenity bot I need a little something that runs an async task every so many minutes. Normally I'd do a tokio::spawn, but I can't find anything similar in the shuttle-runtime. Is there a prefered way to achieve this?
  • a

    agreeable-painting-48846

    05/24/2023, 5:13 PM
    tokio::select!()
    can do this fairly well - the custom service docs goes over a way you can use it: https://docs.shuttle.rs/tutorials/custom-service
  • l

    late-sandwich-93145

    05/24/2023, 5:15 PM
    Aye thanks, that's just what I was looking for!
  • a

    agreeable-painting-48846

    05/24/2023, 6:09 PM
    Happy to help
  • l

    late-sandwich-93145

    05/24/2023, 6:37 PM
    Oh, to make it even easier, doing a tokio::spawn(async move { loop { ... }}), just works fine even after deploying. I thought it wasn't working but that was something else entirely.
  • a

    astonishing-laptop-19143

    05/24/2023, 10:56 PM
    Is there a way to deploy my project with the openssl crate? I recently added
    openssl = "0.10.52"
    to my Cargo.toml so I can use tokio-postgres and postgres-openssl. This works fine when I do cargo shuttle run and host locally but once I deploy I run into websocket errors.
  • c

    careful-iron-7275

    05/24/2023, 10:59 PM
    WebSocket errors? As in communication with Shuttle or WebSocket errors from clients to your deployment?
  • a

    astonishing-laptop-19143

    05/24/2023, 11:02 PM
    This is the error I'm getting

    https://cdn.discordapp.com/attachments/953991447089127456/1111066628260626482/image.png▾

  • a

    agreeable-painting-48846

    05/24/2023, 11:04 PM
    Maybe try using
    cargo shuttle project restart
    to restart the container then deploy again
  • a

    astonishing-laptop-19143

    05/24/2023, 11:11 PM
    this worked. TY!
  • a

    agreeable-painting-48846

    05/24/2023, 11:15 PM
    No worries, happy to help
  • l

    late-sandwich-93145

    05/25/2023, 10:19 AM
    Where do I go to if there is an issue with my deployment? My project is stuck in loading state for 12 hours now and I'm unable to access logs or issue a stop or clean command.
  • a

    agreeable-painting-48846

    05/25/2023, 10:23 AM
    Heya, it's normally easiest to open a thread in #1020096112666890321
  • r

    refined-ram-93026

    05/27/2023, 11:54 AM
    I dunno if this is the right channel for this, I hacked together support for nuxt in the create-shuttle-app thingy, but its real ugly atm (i just wanted to see if i could make it work, as i, how to put it lightly, prefer working with vue) - how to proceed, is there interest in this? Deployed static nuxt demo app: https://my-app-94f23b.shuttleapp.rs/