Working with in RedTamarin


Hi. I’m thinking about using redtamarin to create easy REST api for library is using classic sockets and classic http requests and I think it should work. What do you think?



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 do it with HttpRequest which uses socket
and 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 SocketSystem, StreamServer, 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 HttpConnection

would become simpler to deal with

for ex:

private var _stream:StreamClient;

private function _open( hostname:String, port:String ):int
    _stream.connect( hostname, uint( port ) ); // much simpler