Native C++ requests

1 view
Skip to first unread message

Michael Munson

unread,
Jun 21, 2017, 4:12:13 AM6/21/17
to MOO-...@googlegroups.com
I was fooling around with adding native C++ REST API client into the MOO (using http://whoshuu.github.io/cpr/ which is a wrapper for libcurl.) 

It was easy to just slap it in there, but obviously it wouldn't be super useful to block the main loop while waiting for the microservice Joe Bob still runs on his Pentium 90mhz.

The async request API is pretty simple, and theres pretty good examples from Todd's http parser and other things to make a callback so it doesn't block.

Although, from what I can tell the exec() built-in does it instead by creating a child and then running the execve which blocks the child, then it gets the stdout from the stream when SIGCHLD is sent when the child terminates.

I'm not sure which the better approach would be, or if it is even necessary. 

I use a MOO wrapper around exec()ing the actual curl command, it always seemed a bit clunky but it does work I guess.

Anybody have any thoughts?
Reply all
Reply to author
Forward
0 new messages