Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    mmjvox
    @mmjvox
    I used some reserved keywords of SQL as my column names in my table. How can I customize my model (model generated by dragonctl) to add grave accent before and after the name of column? for example change usage word to usage. I modified the strings in the model CPP file but it had no effect and orm generated same SQL string as before
    mmjvox
    @mmjvox
    I didn't look at the header file of model, some of thing that I was looking for were there. my problem fixed.
    mmjvox
    @mmjvox
    I am aware that the best way to avoid this type of problems is not using the reserved keywords, But the orm would be much more complete if it could also handle reserved keywords
    Rafael Bugajewski
    @rbugajewski
    Hello, happy new year! Thanks for the feedback.
    Hany Greiss
    @hanyg

    Hello,

    Wonderful library! Just trying out things at the moment and I'm getting an error from one of the examples in the docs on views. The following seems to blow up with a BAD TYPE error message. I think the template type in the example may be in correct:

    <%c++
    auto para=@@.get<std::unordered_map<std::string,std::string>>("parameters");
    %>

    The code populate the parameters as follows:

    HttpViewData data;
    data.insert("title", "XListParameters");
    data.insert("parameters", para);
    auto resp = HttpResponse::newHttpViewResponse("listparams.csp", data);

    Any help would be appreciated.

    Thanks

    mmjvox
    @mmjvox
    for split a string to vector of strings there is a function in utils:
    utils::splitString
    mmjvox
    @mmjvox
    but I didn't found any function for join vector of strings, I used boost for now. Is there any built in function in drogon framework for this?
    Are you interested in adding such useful functions to utils?
    mmjvox
    @mmjvox
    How can I help and cooperate?
    Rafael Bugajewski
    @rbugajewski
    Hello, and welcome! For the start you can take a look at the code, pick an issue, and create a PR.
    msula2
    @msula2
    I have been trying to access the Drogon docsforge but it isn't working, what's the next best option?
    Harris Brakmić
    @brakmic
    I've written an article on building responsive web apps with htmx and C++. The backend framework I use there is Drogon.
    https://blog.brakmic.com/writing-hdas-with-htmx-and-c/
    Rafael Bugajewski
    @rbugajewski
    @msula2 You can read it on Github.
    @brakmic πŸ‘
    Instellate
    @instellate:instellate.xyz
    [m]
    Anyone else having problems with dbclient futures? My entire application freezes whenever I try to use them.
    An Tao
    @an-tao

    Anyone else having problems with dbclient futures? My entire application freezes whenever I try to use them.

    https://github.com/drogonframework/drogon/wiki/ENG-FAQ-1-Understanding-drogon-threading-model, please refer to the article.

    Instellate
    @instellate:instellate.xyz
    [m]
    Thanks!
    RAVER0306
    @RAVER0306
    How does drogon implement something like nginx try_files $uri $uri/ /index.html
    Bahman Yunuszoda
    @Baxulio

    Hello! I can serve my React app through drogon but there is a problem.

    For example:

    1. I open react app in browser
      http://my-react-app.com
      and it opens.
    2. I navigate to another page within the app by clicking a button and it navigates resulting to
      http://my-react-app.com/admin
    3. I refresh the page but it shows 404 Not found

    How to solve it?

    P.S. IMHO if one refreshes browser on different pages, drogon must redirect to index.html

    Bahman Yunuszoda
    @Baxulio
    @RAVER0306 Have you found the solution for nginx try_files $uri $uri/ /index.html ?
    β„œπ”¦π”°π”¦π”«π”€ π”Šπ”²π”žπ”―π”‘π”¦π”žπ”«π”¬
    @scuroguardiano:matrix.scuroguardiano.net
    [m]
    Can't you guys just write a function for it? It would be like 10 lines of code, you check if file exists, if so you send it to the user otherwise return 404
    Bahman Yunuszoda
    @Baxulio
    Sure, I'm not requesting for a new feature. I'm asking whether there are any options to reach this kind of functionality. For example I wrote the following code and it works but not as expected
       drogon::app().setDefaultHandler([](const drogon::HttpRequestPtr &req, std::function<void (const drogon::HttpResponsePtr &)> &&callback){
            callback(drogon::HttpResponse::newRedirectionResponse("/"));
        });
    β„œπ”¦π”°π”¦π”«π”€ π”Šπ”²π”žπ”―π”‘π”¦π”žπ”«π”¬
    @scuroguardiano:matrix.scuroguardiano.net
    [m]
    Because what you want is not redirection but sending this what you're doing in "/" handler, just write the same code you have in "/" handler in default handler and it should work
    Coz you must preserve path if you want react to load correct view
    Bahman Yunuszoda
    @Baxulio
    Ok, I found 2 similar ways that bring me closer to the solution but I'm not confident that these are true ways, anyway I will post them here:
        drogon::app().setDefaultHandler([](const drogon::HttpRequestPtr &req, std::function<void (const drogon::HttpResponsePtr &)> &&callback){
            // first way
            req->setPath("/" + drogon::app().getHomePage());
            drogon::app().forward(req, std::move(callback));
    
            // second way
            // callback(drogon::HttpResponse::newFileResponse(drogon::app().getDocumentRoot() + "/" + drogon::app().getHomePage()));        
        });
    youngGameDevv
    @youngGameDevv
    hi, i bought ssl. I got files : ...csr.txt , ...key.txt , ...intermediate.pem, ..certifiacate.pem wchich files should i use in drogon?
    Lynxes Exe
    @lynxes:matrix.org
    [m]

    Hi @youngGameDevv I did something like this for an old project of mine:

      "ssl": {
        "cert": "../ssl/cert.pem",
        "key": "../ssl/key.pem"
      }

    You can find more info about it here: https://github.com/drogonframework/drogon/wiki/ENG-10-Configuration-File#ssl

    Anyway, I think you want to use the "certificate.pem", not sure if the key is required or not honestly, according to the docs in some cases a single file could contain both certificate and key, in that case you should set both "cert" and "key" parameter to the same path, the requirement seems to be that they need to be .pem format though.

    5 replies
    Anyway, I had a question (I see someone else had already asked actually)... Why is DocsForge down? Has the GitHub wiki been aligned with what DocsForge offered?
    Also, will DocsForge come back? I really like the ability to comment and interact directly below docs pages (this is how some bugs may emerge or improvements and discussion about the docs may happen)
    Lynxes Exe
    @lynxes:matrix.org
    [m]
    Also, another question, does anybody have any examples of how to send large files over HTTP/S using Drogon?
    youngGameDevv
    @youngGameDevv
    I did it like this. I changed from .txt to .pem
    I uploaded it on server and add in config files but it didnt work
    Ghost
    @ghost~63ceac356da0373984bd64bd
    Hi @All
    I have been doing research and from what I can see. Apparently Drogon is the fastest web application framework around.
    I don't know anything about it. just heard about it.
    I was wondering what you can do with it besides web development and what it is best for?
    Also I wanted to know if you can build games with it?
    Xojiakbar Sadritdin o'g'li Jamoldinov
    @XojiakbarJamoldinov
    Hello. Is drogon support tcp connection?
    how to create custom protocol on top of tcp with drogon?
    Ghost
    @ghost~63ceac356da0373984bd64bd
    is this community even still active?
    An Tao
    @an-tao

    Hello. Is drogon support tcp connection?

    you could use the trantor tcp library which is used in Drogon to create a Tcp application.

    Xojiakbar Sadritdin o'g'li Jamoldinov
    @XojiakbarJamoldinov
    Are there tcp library examples
    tastytea
    @tastytea:tastytea.de
    [m]
    Hi, i think you forgot to make a tag for trantor 1.5.10? The β€œBump version to 1.5.10” commit is there but no tag. 😊
    An Tao
    @an-tao

    Hi, i think you forgot to make a tag for trantor 1.5.10? The β€œBump version to 1.5.10” commit is there but no tag. 😊

    you are right, thanks for reminding

    An Tao
    @an-tao

    Are there tcp library examples

    You could refer to the HttpServer and HttpClient parts in Drogon

    tastytea
    @tastytea:tastytea.de
    [m]
    thanks! πŸ’–
    Sampat
    @fd98279
    Hello, could you point me to documentation on how to redirect http to https? so request to port 80 should be redirected to 443
    An Tao
    @an-tao

    Hello, could you point me to documentation on how to redirect http to https? so request to port 80 should be redirected to 443

    You don't need to write any code for this, you could enable the SecureSSLRedirector plugin.

    orochi663
    @orochi663
    Hi, need example for fetching video in chunks and send i.e. audio or video streaming example.
    Kindly help
    alyubimof
    @alyubimof

    Hi, I have a problem with Drogon WebSocket app. The WebSocket freeze main thread of Drogon from this point the main thread of drogon stop handling any new requests for creating new HttpClient or new WebSocket connection. I notice that the problem happen when app try to close connection stop() of WebSocket was called, but someone still tries to send data over the closed socket, based on this message:
    | 20230130 09:37:50.236421 UTC 10 WARN Connection is not connected, give up sending - TcpConnectionImpl.cc:1051
    this line is last for main IO Drogon thread #10
    is it a known issue? I checked my code and din not found any lock situation after WebSocket connection supposed to be closed.
    Could you please give me advice how to create new HttpClient not on main thread, can I use one of listening threads and how to prevent listeners to use it for not crossing?

    more logs:
    | 20230130 09:37:50.236241 UTC 10 TRACE [parse] plain data - WebSocketConnectionImpl.cc:285
    | 20230130 09:37:50.236312 UTC 10 TRACE [sendWsData] send 2 bytes - WebSocketConnectionImpl.cc:70
    | 20230130 09:37:50.236360 UTC 10 TRACE [~TcpClient] TcpClient::~TcpClient[httpClient] - connector - TcpClient.cc:80
    | 20230130 09:37:50.236369 UTC 10 TRACE [handleClose] connection closed, fd=117 - TcpConnectionImpl.cc:965
    | 20230130 09:37:50.236381 UTC 10 TRACE [operator()] connection disconnect - WebSocketClientImpl.cc:78
    | 20230130 09:37:50.236395 UTC 10 TRACE [handleClose] to call close callback - TcpConnectionImpl.cc:975
    closed socket 117 this socket was created and normally functional. Then stop() was called
    not really sure that this data going throw same #117 socket because my app is multithreading, and it could be another WebSocket connection, but last line of logs say that app tries to send data over closed connection
    | 20230130 09:37:50.236417 UTC 10 TRACE [parse] plain data - WebSocketConnectionImpl.cc:285
    | 20230130 09:37:50.236419 UTC 10 TRACE [sendWsData] send 4 bytes - WebSocketConnectionImpl.cc:70
    | 20230130 09:37:50.236421 UTC 10 WARN Connection is not connected,give up sending - TcpConnectionImpl.cc:1051

    Bahman Yunuszoda
    @Baxulio
    Hi guys!
    1. How to create websocket server dynamically.
    2. and are there any ways to assign this websocket server to another eventloop?
    3. if this is not the case, then is const WebSocketConnectionPtr& wsConnPtr thread safe?
    Rahul
    @rhnaik_twitter
    Has anyone tried creating sever side event API using Drogon? I tried newstreamResponse but unable to push message later as connection get closes