Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    daz
    @bigg-daz
    -- Install configuration: "release"
    -- Installing: /usr/local/lib/libdrogon.a
    CMake Error at cmake_install.cmake:46 (file):
    file INSTALL cannot copy file "/drogon/install/build/libdrogon.a" to
    "/usr/local/lib/libdrogon.a": Permission denied.
    Alpine dockerfile seems a bit wonky.
    Jalalidin
    @Jalalidin
    How to call other C++ project's function in Drogon project ?
    1 reply
    Clément Gamé 🧠
    @WintermeW_twitter
    hi, i am currently trying to use a Websocket controller along with a pubsubservice so i paid a close attention to the websocket chat example provided in the repos, but unfortunately it doesn't really cover my usecase. indeed the chat showed as example works in "closed loop" where incoming messages get forwarded back to the other subscribers of the room. what i want to achieve is to use an inmem data container (say a vector) coming from another part of my program and use its content to publish data to subscribers. So my question is what would be the best pattern to achieve this ? What would be the most elegant way for my WebSocketController to obtain the reference of my std::vector and stream its content ? thank you.
    P.R.
    @prothegee

    Hello,
    where can I find a working example of using execSqlAsync (Postgres) in Drogon?
    The short code snippets provided on the official Drogon website do not compile.

    Use execSqlAsyncFuture instead if you want to make inside your function before the callback,

    https://github.com/prothegee/DrogonSQL/blob/main/controllers/test.cc#L66

    1 reply
    An Tao
    @an-tao

    hi, i am currently trying to use a Websocket controller along with a pubsubservice so i paid a close attention to the websocket chat example provided in the repos, but unfortunately it doesn't really cover my usecase. indeed the chat showed as example works in "closed loop" where incoming messages get forwarded back to the other subscribers of the room. what i want to achieve is to use an inmem data container (say a vector) coming from another part of my program and use its content to publish data to subscribers. So my question is what would be the best pattern to achieve this ? What would be the most elegant way for my WebSocketController to obtain the reference of my std::vector and stream its content ? thank you.

    you could store the vector in websocket controller.

    2 replies
    Ichiro
    @HadesD
    how to disable upload ?
    image.png
    drogon auto create tmp folder here, my app do not use upload func
    image.png
    An Tao
    @an-tao
    no, you do use it. drogon uses tmp files to store requests data when they are too big.
    Ichiro
    @HadesD
    oh, tks
    daz
    @bigg-daz
    How does the trantor callback API work?
    using RecvMessageCallback = std::function< void(const TcpConnectionPtr &, MsgBuffer *)>
    Do I read the MsgBuffer to read stuff sent by the client and write into the MsgBuffer to send stuff to the client or do I need to use TcpConnectionPtr->getRecvBuffer() to read and/or write?
    daz
    @bigg-daz
    Nvm found out how it works through the drogon code.
    headofdeveloper
    @headofdeveloper
    hello @an-tao when we get a new http request, the parseJson() is running by default or not? I dont want to get a JSON object - so in terms of performance perspective I dont need to have json object. getBody is enough for me
    An Tao
    @an-tao
    drogon don't parse the json body until you call the getJsonObject method first time.
    Roman Baschmakov
    @r.baschmakov_gitlab
    Hello dear community! I have a question about db client transactions. What exactly are they for? On my attempt to fire a SQLite3 script which is a multi statement transaction drogon tells me it doesn't support transactions.
    Roman Baschmakov
    @r.baschmakov_gitlab
    To be specific, the error message says "Multiple semicolon separated statements are unsupported", which is thrown in Sqlite3Connection.cc line 156
    An Tao
    @an-tao
    you should execute SQL statements one by one.
    Roman Baschmakov
    @r.baschmakov_gitlab
    SQLite supports transactions out of the box, see https://www.sqlite.org/c3ref/exec.html
    Drogon does not propagate this support then?
    daz
    @bigg-daz
    Can I assume trantor won't touch the contents of the messageBuffer while the recvMessageCallback runs?
    Specifically for using slices of data I've already retrieved while the callback runs.
    An Tao
    @an-tao

    Can I assume trantor won't touch the contents of the messageBuffer while the recvMessageCallback runs?

    Yes

    daz
    @bigg-daz
    Thank you.
    Ichiro
    @HadesD
    I got an error about trying to use coroutines
    image.png
    how can I fix this for HttpController?
    rajhlinux
    @rajhlinux
    Hello

    Where do I put code for dragon to do some custom automation for the following? :

    Example:
    Client from website presses a button to read some data from the local PostgreSQL database.

    Dragon will listen for requests using websockets.
    Then dragon will parse the JSON data that was requested from client.
    Dragon needs to know what this parsed JSON data request means.
    Parsed JSON data says to fetch some data from local PostgreSQL database.
    After dragon fetches data from local PostgreSQL database, dragon needs to send this fetched data to the client using websocket.

    The above can be easily done using node.js But how can the above objectives be done using dragon?

    Are there any tutorials other than WiKi and docsforge?
    I find WiKi and docsforge a bit too advanced and complicated for a beginner to understand.

    Thanks

    Ichiro
    @HadesD
    @rajhlinux
    your json has fixed structure?
    so you first will have to decode messageString to json, then extract the struct, then work with them, like in nodejs
    rajhlinux
    @rajhlinux
    where do I put the code?
    An Tao
    @an-tao

    how can I fix this for HttpController?

    Use value parameters instead of referance type parameters when using coroutine handlers.

    Ichiro
    @HadesD
    @an-tao
    can you specify how to write in HttpController?
    i'm still don't know how to fix it, sorry
    An Tao
    @an-tao
    @an-tao
    can you specify how to write in HttpController?
    i'm still don't know how to fix it, sorry
        Task<> get(
            HttpRequestPtr req,
            std::function<void(const HttpResponsePtr &)> callback);
    P.R.
    @prothegee
    Hey, @an-tao
    Base on this example, https://drogon.docsforge.com/master/database-general/database-transaction/#one-example
    Where did it happen the rollback when do transaction?
    Rafael Bugajewski
    @rbugajewski
    @prothegee This is stated in the documentation: “The outermost braces are used to limit the scope of the transPtr so that it can be destroyed in time after the execution of sql to end the transaction.”
    That means that a transaction is implicitly defined by the scope.
    P.R.
    @prothegee
    Owh, seems like I distracted by arrow operator. Thank you to make it clear, @rbugajewski
    nobody
    @nobody93
    Just downloaded, built and run the dragon examples, but could not find any example to display background image, nor could find in WiFi, appreciate anyone give an example now to display and run images in a simple example. Thank you very much
    are there any dragon email discussion forum or mailing list for help?
    Rafael Bugajewski
    @rbugajewski
    @nobody93 What exactly do you mean by “displaying background images”? You can certainly use HTML/CSS in the CSP templates, and also combine these with parameters passed in from controllers.
    nobody
    @nobody93
    @rbugajewski, sorry I am new here, is there a demo to use HTML/CSS in the CSP templates? I am learning from drogon/examples currently, could not find an example for it, nor tutorial from WiKi
    nobody
    @nobody93
    Is the ENG 04 1 Controller HttpSimpleController did you refer to? Tried it, but no idea how to complete the code
    I was looking for a simple web application example to display background image and to rotate images automatically in defined time interval.
    nobody
    @nobody93
    According to the WiFi, to run CSP, it should compile with -DCMAKE_ENABLE_EXPORTS=on, but after running it, I could not find dynamic libraries with *.so, what could I be missing?
    Rafael Bugajewski
    @rbugajewski
    @nobody93 I’m not sure what you’re referring to, but you can check out the simple Hello World example, at https://github.com/drogonframework/drogon/blob/master/examples/helloworld/HelloView.csp