Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 19:42
    robjtede labeled #1755
  • 19:41
    robjtede demilestoned #1721
  • 19:40
    jplatte closed #1721
  • 19:40
    jplatte commented #1721
  • 19:14
    codecov-io commented #1754
  • 18:55
    robjtede commented #1721
  • 18:54
    robjtede commented #1251
  • 18:54
    robjtede commented #1251
  • 18:54
    robjtede commented #1251
  • 18:54
    robjtede commented #1735
  • 18:53
    robjtede commented #1727
  • 18:46
    robjtede commented #1754
  • 18:44
    robjtede commented #1754
  • 18:44
    robjtede commented #1754
  • 18:43
    robjtede edited #1754
  • 18:42
    robjtede synchronize #1754
  • 18:42

    robjtede on on-connect

    fix populate extensions for htt… (compare)

  • 15:28
    robjtede commented #1754
  • 12:59
    robjtede commented #1754
  • 11:42

    github-actions[bot] on gh-pages

    Deploying to gh-pages from @ c… (compare)

Dag
@scav
I need to get a copy of the request body as it enters my service, right now I am trying to fetch it from in a impl FromRequest trying to create a copy of the body from fn from_request(r: &HttpRequest, p: &mut dev::Payload) -> Self::Future dev::Payload. I have to admit I have no idea how I am supposed to do this, or if there is any other better way of getting ahold of the request body before processing the request (the body contains some data I need to verify the request signature).
15 replies
Zihua Wu
@lucifer1004
How to serve files with UTF-8 contents (e.g., Chinese characters) with actix-files?
5 replies
Aspect1337
@Aspect1337
Hello. Is there anyone who has a working code rep with Actix-web + React?
2 replies
Xu Desheng
@xudesheng
It seems like actix-mqtt becomes ntex-mqtt now, is there any way to let ntex-rt and actix-rt work together?
5 replies
Pankaj Jangid
@jangid
Just noticed - actix3 is out. Thanks a lot team. Great effort.
Elang89
@Elang89
Got a question, though not necessarily about actix but it relates to it somewhat. When is it a good reason to use actors? Like, what is a good use case for actix and actors in general?
3 replies
Tomas Ostasevicius
@to266
Hi there, is there some way to inject state into the Axtix::web App? I'd like to be able to mock a struct that implements a trait (which wraps an external API). The first hope was to have some &dyn MyTrait in the app_data, but since that matches from the HashMap based on TypeId, inserting a particular type and extracting with web::Data<&dyn MyTrait> does not actually work. So... any suggestions?
10 replies
Dan
@dansgithubuser
Is there an easy way to get my logger middleware to show request and response bodies?
Or a hard way I suppose, but... no harder than just writing logging into my handlers...
3 replies
Simon Paitrault
@Freyskeyd

Hello!

I'm trying to build an app where I've an API (with actix-web) and another domain runtime (with actix actors) that deal with database and other stuff. I was wondering what was the best way to communicate between those two entities and if there is some example around that kind of project?

8 replies
matrixbot
@matrixbot
tml hi, is there any benefit to the sync actor ("executor") pattern, as in the old version of the docs over just using web::block as in the new docs?
1 reply
matrixbot
@matrixbot

tml > <@robjtede:matrix.org> @tml if you're expecting to use other actors i guess. web::block has been the recommended method for DB calls since v2 and the docs now reflec that.

Hm, is web::block incompatible with actors?

matrixbot
@matrixbot

tml > <@tmladek:matrix.org> Hm, is web::block incompatible with actors?

As in, can I call web::block inside of actors and vice-versa?

matrixbot
@matrixbot

robjtede > <@tmladek:matrix.org> As in, can I call web::block inside of actors and vice-versa?

Sure you can do that but theres kinda no point doing both and just requires more passing around of channel senders.

Bernard Labno
@blabno

I've got

#[derive(Message, Debug)]
#[rtype(result = "Vec<String>")]
pub struct GetItems;

impl Handler<GetItems> for SomeActor {
    type Result = Vec<String>;

    fn handle(&mut self, msg: GetItems, _ctx: &mut Self::Context) -> Self::Result {
        println!("Got {:?}", msg);
        vec![]
    }
}

which gives me

the trait bound Vec<std::string::String>: MessageResponse<SomeActor, GetItems> is not satisfied.

I've seen example where Result type was Result<Vec<String>> but I don't get why that works.

13 replies
matt-vib
@matt-vib
This message was deleted
Kevin Choubacha
@kbacha
Hi! I'm trying to setup an actix-web server but also want to daemonize the main process. I have it set up using the daemonize crate (https://docs.rs/daemonize/0.4.1/daemonize/) but I'm getting some errors when the server actually boots:
[2020-09-17T19:57:37Z ERROR actix_server::signals] Can not initialize stream handler for Int err: Bad file descriptor (os error 9)
[2020-09-17T19:57:37Z ERROR actix_server::signals] Can not initialize stream handler for Hup err: Bad file descriptor (os error 9)
[2020-09-17T19:57:37Z ERROR actix_server::signals] Can not initialize stream handler for Term err: Bad file descriptor (os error 9)
[2020-09-17T19:57:37Z ERROR actix_server::signals] Can not initialize stream handler for Quit err: Bad file descriptor (os error 9)
Kevin Choubacha
@kbacha
I think I need to daemonize before the actix-rt starts so that the daemonizing doesn't close any file descriptor listeners... But I can't find examples of setting that up.
Kevin Choubacha
@kbacha
Nothing I've tried works to properly boot the runtime other than the macro...
Alan Briolat
@alanbriolat
Am I crazy if I want to use actix directly as an actor framework? I'm really struggling to understand the boundary between async/await and message-passing. Examples make use of addr.send().await inside an async fn main(), but are less clear on how to do the same thing within a Handler<T>::handle(), which isn't an async fn...
Alan Briolat
@alanbriolat
For example, I have an actor that needs to establish a TCP connection once the actor is already started. The documentation for actix::actors::resolver only shows use from async functions outside of an actor, so what pattern should I be using to use that from within a message handler?
19 replies
NielDuysters
@NielDuysters
I can't find anywhere in the Actix-Cors documentation on how to allow Access-Control-Allow-Origin so I can allow GET/POST requests to my Rust-code from other domains.
1 reply
Alex
@awulkan
Maybe you already know this, but the Actix benchmarks are gone from TechEmpower.
12 replies
ghostff
@Ghostff
Why does actix.rs(https://actix.rs/docs/databases/) encourage using Diesel instead of async_pg?
2 replies
Paul Kassianik
@paulkass
Hey guys, wondering if there's any documentation to handle file uploads in Post requests?
2 replies
zero-systems
@zero-systems
How do I get current tokio/actix-rt loop inside HttpServer::new(move || App::new()?
3 replies
For each worker
I need to do some async actions while creating .data
Alan Briolat
@alanbriolat
Is there an upperbound on what a sensible number of actors is, either in terms of performance or just "you're doing it wrong"?
10 replies
Alan Briolat
@alanbriolat
I'm playing around with trying to build a BitTorrent client, which is obviously a pretty IO-bound use case. My thoughts so far are that the logical division of responsibilities, and therefore actors, is a single Session actor (which is the entry point for the frontend communicating with the core), a Torrent actor per loaded torrent (potentially thousands), a Peer actor per known peer (tens of thousands, only a few hundred of which would have active connections at any one time), and some mechanism to globally limit simultaneous connection count and file handle count.
Does this sound sensible, or like I should be considering pooling things into fewer actors, or not even using the actor model at all?
WiredSharp
@WiredSharp
Hi all, as a Rust Newbie, i tried to build a web site with actix-web. I wanted to process default url to index.html. So i decided to write a middleware to do the job. To modify the Request uri, i followed what was done in Normalize middleware but it looks to me a lot of code to change the path of the request, isn't there any simpler way to do this?
2 replies
Kevin Hoffman
@autodidaddict
I'm sure this has been asked a million times... I've got a synchronous function (mandatory, it's an FFI callback) that needs to make a call into the actor system, await the result, and then return the result. I've tried all forms of "block_on" that I can think of and none of them work. What's the right way to "de-async" a call to an actor?
3 replies
Bernard Labno
@blabno
expected struct Box, found struct Pin
Bernard Labno
@blabno
I've noticed that for ResponseFuture the Box::pin works, but for ResponseActFuture the Box::new is needed instead
17 replies
Bernard Labno
@blabno
btw. I am looking for someone to review ~1k lines of my actix code, I'm willing to pay for the job.
Bernard Labno
@blabno
Is it possible to convert ActorFuture to Future?
7 replies
Brian Victor
@brianhv
are there any reasonably mature solutions for (customer) authentication and identity management? basically looking to fill the role that django auth does, with login/registration/password reset/etc. should I be looking at something like AWS Cognito with OIDC?
Cris Liao
@clia
SSE long-polling connection server using Actix-web 3.0.2, while the clients use Java & okhttp lib, the server can support concurrent connections more than 400K; but when the clients use C++ & libcurl, when concurrent connections add up to 130K, the server will hangs on and logging:
"Service 0.0.0.0:443 is unavailable"
Accepting connections on 0.0.0.0:443 has been resumed
Anybody knows where the problem is?
ghostff
@Ghostff

Hi guys, I have this struct (diesel):

#[table_name = "users"]
#[derive(Insertable, Debug)]
pub struct NewUser<'a> {
    pub first_name: &'a str,
    pub last_name: &'a str,
}

let m = NewUser {
    first_name: "Foo",
    last_name: "Bar",
};

But am wondering why, I can do this:

let user: User = diesel::insert_into(...).values(&m).get_result(conn).expect(...);

But not this:

impl<'a> NewUser<'a> {
    pub fn create( & self, conn: &PgConnection) -> self::User {
        diesel::insert_into(...).values(self).get_result(conn).expect(...)
    }
}

m.create(conn);
1 reply
Tom CHEN
@surfingtomchen
Hi guys, is there any comprehensive example of actix-net? I'm quite new for the rust and seeking help to use actix-net framework to build my tcp server. TIA.
6 replies
Geometrically
@Geometrically
Hey, is there any examples/projects which use Auth0 for authentication?
1 reply
KOKOU AFIDEGNON
@afidegnum
hi, how do i extract data from web::data pool ?
1 reply
Geometrically
@Geometrically
How can I pass data from a middleware to a route?
1 reply
junefar
@junefar
Hi, How do I stop an actor with internal loops,sending a message doesn't work.
For example ,I use amiquip with actor, I can't stop it.
        for (_i, message) in consumer.receiver().iter().enumerate() {
            match message {
                ConsumerMessage::Delivery(delivery) => {
                    let msg = delivery.body.clone();
                    let foo = String::from_utf8(msg).unwrap();
                    let data = foo.to_string();
                    let k: Value = serde_json::from_str(&data).unwrap();
                    ctx.stop(); // doesn't work
                }
                other => {
                    println!("Consumer ended: {:?}", other);
                    break;
                }
            }
        }
33 replies