Stiffstream / restinio

Cross-platform, efficient, customizable, and robust asynchronous HTTP(S)/WebSocket server C++ library with the right balance between performance and ease of use
Other
1.16k stars 93 forks source link

server side connection timeout ? #224

Closed hassan379 closed 2 months ago

hassan379 commented 2 months ago

Thank you for this great library. Does this library support connection timeouts on server side? I have a function that can run for a long time depending on the passed parameters. Does the server cancel the request and throw an exception or error that can be handled to send a proper response after a specific time? Thanks in advance.

eao197 commented 2 months ago

Hi, @hassan379

RESTinio supports timeouts by default. There is handle_request_timeout setting's parameters that controls how long a handler can work (you can find it in the "settings" section).

But take into account the threading model of RESTinio. If you handle you request in a synchronous maner, then the RESTinio doesn't have ability to break a connection if the timeout elapsed.