zerodha / cppkiteconnect

C++ Kite Connect API library / SDK
Other
49 stars 22 forks source link

Thoughts on replacing cpp-httplib with a non-blocking library #17

Closed rahulswaminathan closed 3 years ago

rahulswaminathan commented 3 years ago

Hello, Due to the blocking nature of client and server in cpp-httplib and as its author isn't keen on making it non-blocking, any thoughts on replacing cpp-httplib with a non-blocking library like mongoose?

bhumitattarde commented 3 years ago

Just gave a quick look to mongoose, looks good.

I doubt a non blocking HTTP library will help a lot considering the fact that KiteConnect REST API itself has a rigid requests/second limit. Performance boost, if any, by integrating an asynchronous HTTP library with cppkiteconnect will most likely be negated because of the limit.

Apart from that, replacing cpp-httplib with an asynchronous library will take up lots of time, and I'm currently the only maintainer of the library; I do it in my free time. I may consider it in the future (provided I have time), but right now, I don't think this is possible.

rahulswaminathan commented 3 years ago

I can start working on this and create a pull request.

bhumitattarde commented 3 years ago

@knadh @rhnvrm Thoughts?

rhnvrm commented 3 years ago

Hey

@knadh and I discussed this and think it would be better to just stick with a sync library as we won't want to maintain it. @rahulswaminathan if you want you can maintain an asyncio fork and we will be happy to provide inputs.

Also, regarding the benefits, I am skeptical if there would be any benefits in the performance as we are not providing a http-server and just using a client. You can slap on a async http-server in case you want to maintain multiple users. Or in case you are using the cppkiteconnect client from your async code, you can anyways keep using it since it is sync. I/O wait would ideally never exceed 3 seconds either. Maybe you could shed light on your usecase and we could see if it is useful in that case?

rahulswaminathan commented 3 years ago

Thanks for the inputs @rhnvrm @bhumitattarde @knadh!