-
Notifications
You must be signed in to change notification settings - Fork 55
Lua API reference manual
zhaojh329 edited this page Jun 4, 2017
·
11 revisions
git clone https://github.com/brimworks/lua-ev.git
cd lua-ev
cmake .
make
sudo mkdir -p /usr/local/lib/lua/5.1
sudo cp ev.so /usr/local/lib/lua/5.1
git clone https://github.com/zhaojh329/lua-ev-openwrt.git
cp -r lua-ev-openwrt OpenWRTDIR/package/lua-ev
cd OpenWRTDIR
make menuconfig
Languages --->
Lua --->
<*> lua-ev
make package/lua-ev/compile V=s
Init mgr context, return a handle
local ev = require("ev")
local evmongoose = require("evmongoose")
local loop = ev.Loop.new()
local mgr = evmongoose.init(loop)
Listens for the specified address, can plain tcp or http or https.
mgr:bind("8000", ev_handle)
mgr:bind("8000", ev_handle, {document_root = "/www"})
mgr:bind("8000", ev_handle, {ssl_cert = "server.pem", ssl_key = "server.key", document_root = "."})
connect to http or https server
mgr:connect_http("http://www.baidu.com", ev_handle)
mgr:connect_http("https://www.baidu.com", ev_handle, {ssl_cert = "server.pem", ssl_key = "server.key"})