Need help with evmongoose?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

zhaojh329
200 Stars 49 Forks GNU General Public License v3.0 312 Commits 0 Opened issues

Description

DEPRECATED. Evmongoose is an asynchronous, event(libev) based multi-protocol embedded networking library with functions including TCP, HTTP, WebSocket, MQTT and much more. It's based on mongoose and libev implementation and it's support Lua API.

Services available

!
?

Need anything else?

Contributors list

No Data

DEPRECATED. Replaced by libuhttpd, libuwsc, libumqttc

Evmongoose(中文)(github)

Evmongoose is an asynchronous, event(libev) based multi-protocol embedded networking library with functions including TCP, HTTP, WebSocket, MQTT and much more. It is based on mongoose and libev implementation and it's support Lua API.

Evmongoose supports highly customized to extend your application. Before I started this project, I had never found a HTTP server library that was satisfied with the event based framework, and those HTTP server libraries could only loop it'sown objects and could not add my own objects. For example, I want to monitor a signal or a file through the event.

Features

  • New from evmongoose

    • Using libev programming
    • Highly customized to extend your application based on libev
    • Lua API(except wrapper for evmongoose and additional include frequently-used posix C API)
  • Inherited from mongoose

    • plain TCP, plain UDP, SSL/TLS (over TCP, one-way or two-way)
    • Alternative openssl and mbedtls
    • HTTP client, HTTP server
    • HTTP File Upload
    • Proxy
    • WebSocket client, WebSocket server
    • MQTT client, MQTT broker
    • CoAP client, CoAP server
    • DNS client, DNS server, async DNS resolver
    • Url Rewrite

Example

How To Compile

For Ubuntu

Install dependency Libraries

  • libev-dev libssl-dev lua5.1 liblua5.1-0-dev lua-zlib

    sudo apt install libev-dev libssl-dev lua5.1 liblua5.1-0-dev lua-zlib
    
  • lua-ev

    git clone https://github.com/brimworks/lua-ev.git
    cd lua-ev
    cmake . -DINSTALL_CMOD=$(lua -e "for k in string.gmatch(package.cpath .. \";\", \"([^;]+)/..so;\") do if k:sub(1,1) == \"/\" then print(k) break end end")
    make && sudo make install
    

Install Evmongoose(HTTPS Support Default)

git clone https://github.com/zhaojh329/evmongoose.git
cd evmongoose
mkdir build
cd build
cmake ../
make && sudo make install

Install Evmongoose(Disable HTTPS Support)

git clone https://github.com/zhaojh329/evmongoose.git
cd evmongoose
mkdir build
cd build
cmake ../ -DHTTPS_SUPPORT=OFF
make && sudo make install

For OpenWRT/LEDE

git clone https://github.com/zhaojh329/lua-ev-openwrt.git
cp -r lua-ev-openwrt openwrt_dir/package/lua-ev

git clone https://github.com/zhaojh329/evmongoose.git cp -r evmongoose/openwrt openwrt_dir/package/evmongoose

cd openwrt_dir ./scripts/feeds update -a ./scripts/feeds install -a

make menuconfig Libraries ---> Networking ---> evmongoose Configuration ---> SSl (mbedtls) --->

make package/evmongoose/compile V=s

For General embedded environment

First, cross compile Lua

Cross compile lib-ev

git clone https://github.com/kindy/libev.git
cd libev/src
sh ./autogen.sh
export PATH=/home/zjh/lede/staging_dir/toolchain-mipsel_24kc_gcc-5.4.0_musl/bin:$PATH
./configure --host=mipsel-openwrt-linux --prefix=`pwd`/obj
make && make install

Cross compile Lua-ev

git clone https://github.com/brimworks/lua-ev.git
cd lua-ev
export PATH=/home/zjh/lede/staging_dir/toolchain-mipsel_24kc_gcc-5.4.0_musl/bin:$PATH

xxxxx is your cross compiler with directories

cmake . -DCMAKE_C_COMPILER=mipsel-openwrt-linux-gcc -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=BOTH -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY -DCMAKE_FIND_ROOT_PATH=xxxxx make

Cross compile evmongoose

git clone https://github.com/zhaojh329/evmongoose.git
cd evmongoose
export PATH=/home/zjh/lede/staging_dir/toolchain-mipsel_24kc_gcc-5.4.0_musl/bin:$PATH

xxxxx is your cross compiler with directories

cmake . -DCMAKE_C_COMPILER=mipsel-openwrt-linux-gcc -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=BOTH -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY -DCMAKE_FIND_ROOT_PATH=xxxxx make

C API reference manual

Evmongoose dose not change the usage of API in mongoose and libev, so please refer to the API Manual of mongoose and libev. Only one thing to notice is that mgmgrpoll is no longer invoked when using evmongoose.

In addition, evmongoose added a new API: mgmgrsetloop, which is used to set libev's loop for Mgr. If the function is not called, the Mgr will use the default loop:EVDEFAULT.

Lua API reference manual

How To Contribute

Feel free to create issues or pull-requests if you have any problems.

Please read contributing.md before pushing any changes.

Thanks for the following project

If the project is helpful to you, please do not hesitate to star. Thank you!

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.