Tiny Http - Simple http server and client


Tiny Http - Defold Native Extension is a simple http server and client.

Main purpose of this extension is simplifying workflow with the external tools like level editors or IDEs. Reload your level files or change assets on the fly… You can easily trigger almost everything on the running game from everywhere.

This is the initial release, it may contain bugs.

selimanac/defold-tiny-http - GitHub

Server works on iOS, Android, MacOS, Win 10 and Linux(Debian 10.x). HTML5 build is not supported. Since I don’t need it, SSL not supported. But it is possible to add this feature, feel free to PR if you want to.

Server runs on separate thread, it is not a blocker. Client has a thread pool. But timeouts may block the UI for 5 sec(when can’t reach the server). Server endpoints are definable. You can add your GET/POST endpoints by using regex.

There is a simple Event ID passing from client to server. Event IDs are passed as header. Main purpose of Event ID is to grouping and parsing the triggers on the server-side easily.

Client is here to simplify things when using Defold. But of course you can use build-in http requests. If you want to use build-in http requests and Event-IDs, you can simply pass it like this:

local headers = {
    ["Event-ID"] = "1"
http.request("", "GET", http_result, headers)

Or with Curl:

curl --header \"Event-ID: 1\" http://localhost:8800/monster/1

This extension build by using cpp-httplib.
My other native extensions: https://selimanac.github.io/



Nice! Could you please also submit this as an asset to the asset portal?