Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    João Fernandes
    @0rangeFox
    By the way, the variable "_dbClient" is of type: IOThreadStorage<DbClientPtr>
    João Fernandes
    @0rangeFox
    I think I was not very specific to my issue, what I really wanted to know, is regarding the variable "_dbClient", when passing in the "Captures" of the lambdas expressions.
    Rafael Bugajewski
    @rbugajewski
    It’s really hard to say something, because the context is missing.
    João Fernandes
    @0rangeFox
    Yes I get it but I personally also read that and got confused and I can't simplify it any more than that, what I basically meant, if you look there is a "capture" with the following parameter, "_dbClient = *_dbClient" in the last lambda, and I wonder if there is any way to just send "_dbClient" as the first lambda?
    praveenpillay
    @praveenpillay
    For a front end desktop application heavy on real time chart updates from drogon server, what would you guys recommend? Flutter, React Native, Vue or something else? Thank you!
    1 reply
    An Tao
    @an-tao

    Yes I get it but I personally also read that and got confused and I can't simplify it any more than that, what I basically meant, if you look there is a "capture" with the following parameter, "_dbClient = *_dbClient" in the last lambda, and I wonder if there is any way to just send "_dbClient" as the first lambda?

    Why not just capture this pointer instead of _dbClient

    João Fernandes
    @0rangeFox
    Because I need to fetch the object that is inside of the IOThreadStorage. Or am I forgetting something?
    An Tao
    @an-tao
    This kind of callback nesting can be perfectly solved by coroutine
    Alababdiy
    @Alababdiy
    how to get drogon:orm:Row columns ?
    An Tao
    @an-tao
    use index or iterator
    or name
    Alababdiy
    @Alababdiy
    inline json row_to_json(const Row &row){
    json r ;
        for (short i = 0; i< row.size();i++)
        {
            cout << "Key" << row.operator[](i).as<string>();
            cout << "Value" << row.operator[](i).as<string>();
            r.emplace(row.operator[](i).as<string>(),row.operator[](i).as<string>());
        }
        return r;
    }

    use index or iterator

    i can't detect columns name

    An Tao
    @an-tao
    why not use row[i]?
    you could use row[i].name() to get the column name
    Alababdiy
    @Alababdiy

    thanks An Tao

    why not use row[i]?

    Aayush-2492
    @Aayush-2492
    Something strange is happening. If I register a controller from main.cc it works fine but if a define a controller in the controller folder and go to that path it says 404 not found.
    An Tao
    @an-tao
    did you re-configure your project with cmake after adding the controller?
    Aayush-2492
    @Aayush-2492
    Do i need to? I created the controller by drogon_ctl command.
    An Tao
    @an-tao
    yes, you need. drogon_ctl just create the files.
    Aayush-2492
    @Aayush-2492
    Oh
    What line do I need to add to the CMake file then?
    An Tao
    @an-tao
    You don't need add new lines, just run cmake ..
    Aayush-2492
    @Aayush-2492
    OK that but I did run cmake .. and make in the terminal
    An Tao
    @an-tao
    does it work?
    Aayush-2492
    @Aayush-2492
    No.
    I meant before I asked the question, I had run CMake.
    An Tao
    @an-tao
    after you added new controllers?
    please paste your routing macros here
    Aayush-2492
    @Aayush-2492

    METHOD_LIST_BEGIN

    METHOD_ADD(login::loginHandler, "/login", Post);
    METHOD_ADD(login::loginCheckHandler, "/logincheck", Post);

    METHOD_LIST_END

    Screenshot 2021-07-18 at 7.15.08 PM.png
    Image also if it helps ^
    An Tao
    @an-tao
    did you add the spacename and class name to the path when accessing the web?
    or you should use the ADD_METHOD_TO macro to avoid that.
    Aayush-2492
    @Aayush-2492
    Thanks
    I will try it
    Is there an function that lets WS server send messages to all clients(like emit in JS)?
    Or I will have to store the WebSocketClientPtr for each object in a data structure
    An Tao
    @an-tao
    please refer to the PubSubService template, if you search it in the project, you'll find an example of chat room.
    Aayush-2492
    @Aayush-2492
    Thanks @an-tao
    praveenpillay
    @praveenpillay
    Thank you!
    Martin Chang
    @marty1885
    @0rangeFox I tried to get coroutines working on MSYS. But ended up either with libc++/stdc++ clash or MSYS not properly supporting clang.
    You'll have to wait for GCC 11 landing on MSYS, use visual studio or use Linux/WSL
    Aayush-2492
    @Aayush-2492
    How do I set the request parameter for chat room name for using PubSubService link
    An Tao
    @an-tao
    you could put it on URL, /path?chat_room=test
    Aayush-2492
    @Aayush-2492
    Whats the error in this line used inside controller:
    SessionPtr s = std::make_shared<Session>(req->session());
    João Fernandes
    @0rangeFox

    @0rangeFox I tried to get coroutines working on MSYS. But ended up either with libc++/stdc++ clash or MSYS not properly supporting clang.
    You'll have to wait for GCC 11 landing on MSYS, use visual studio or use Linux/WSL

    I do not know how to thank you for your loss of time, but thank you very much for your help, and I will look forward to it.

    João Fernandes
    @0rangeFox
    Someone can explain me a little about regex on endpoints? Because I'm trying to make start from one string, for example "data" with path and tell me doesn't exists that endpoint.
    Example: /v1/user/(?=data)
    Martin Chang
    @marty1885
    What kind of API are you trying to create?
    João Fernandes
    @0rangeFox
    RESTful API.
    Martin Chang
    @marty1885
    Try /v1/user?data={userdata}. Then make the handler void user(....., const std::string& userdata)