yes it should work without issues
it's what I do to communicate with CouchDB which also use a REST API
check out the code here
CouchDB.as do it with
HttpRequest which uses socket
CurlCouchDB.as do it by reusing curl on the command-line
but here the few quirks you may encounter
- socket communication using the C API can be hard to deal with
- as you can see with
HttpRequest, it's not only using sockets
it is also implementing an HTTP client and so parse HTTP etc.
- socket does not support TLS/SSL and so if you need to connect to HTTPS
it does not work yet, and that's why you would need to reuse curl on the command-line
the next release of Redtamarin will provide a
StreamClient class etc. which should help a lot to work with sockets.
And yeah, once those new native classes are in the code, httplib will be updated using those, and I should also publish a couchdblib too, and probably some basic httpclient/httpserver examples.
That means a class like
would become simpler to deal with
private var _stream:StreamClient;
private function _open( hostname:String, port:String ):int
_stream.connect( hostname, uint( port ) ); // much simpler