usage
. I modified the strings in the model CPP file but it had no effect and orm generated same SQL string as before
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
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.
Hello! I can serve my React app through drogon but there is a problem.
For example:
How to solve it?
P.S. IMHO if one refreshes browser on different pages, drogon must redirect to index.html
drogon::app().setDefaultHandler([](const drogon::HttpRequestPtr &req, std::function<void (const drogon::HttpResponsePtr &)> &&callback){
callback(drogon::HttpResponse::newRedirectionResponse("/"));
});
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()));
});
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.
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