ZFFramework
 
Loading...
Searching...
No Matches
ZFDebugServer.h File Reference

debug server More...

#include "ZFAppUtilDef.h"

Go to the source code of this file.

Functions

zfautoT< ZFHttpServerZFDebugServer (zfuint port)
 util to start a debug http server that can receive and run lua code from remote
 
zfautoT< ZFTaskIdZFDebugClient (const zfstring &url, const zfstring &luaCode, const ZFListener &callback=(zft_zfnull))
 see ZFDebugServer
 
zfautoT< ZFTaskIdZFDebugClient (const zfstring &url, const ZFInput &luaCode, const ZFListener &callback=(zft_zfnull))
 see ZFDebugServer
 

Detailed Description

debug server

Function Documentation

◆ ZFDebugServer()

zfautoT< ZFHttpServer > ZFDebugServer ( zfuint port)
extern

util to start a debug http server that can receive and run lua code from remote

typical usage:

// start the debug server
// for the client, post lua code to run on server
ZFDebugClient([](const ZFArgs &zfargs) {
ZFHttpResponse *recv = zfargs.param0();
ZFLogTrim("%s", recv->body());
}
, "ZFUIViewTreePrint(ZFUISysWindow.mainWindow():rootView())"
, "http://localhost:32100"
);
// or, use plain curl
curl -X POST -H "Content-Type:application/json;charset=UTF-8" \
--data '{"run": "ZFUIViewTreePrint(ZFUISysWindow.mainWindow():rootView())"}' \
"http://localhost:32100"
// response data:
{
"errno" : "0",
"error" : "success",
"result" : "result from code",
"output" : "output from code",
}
zfautoT< ZFHttpServer > ZFDebugServer(zfuint port)
util to start a debug http server that can receive and run lua code from remote
zfautoT< ZFTaskId > ZFDebugClient(const zfstring &url, const zfstring &luaCode, const ZFListener &callback=(zft_zfnull))
see ZFDebugServer
#define ZFLogTrim(...)
see ZFLog
Definition ZFLog.h:80
listener data used by ZFListener
Definition ZFArgs.h:20
see ZFHttpRequest
Definition ZFHttpRequest.h:43
virtual zfstring & body()
response body
Definition ZFHttpRequest.h:59