Mongoose - small, fast and simply awesome network library

Recently, I have been looking for a C library which can provide handy API for web-socket protocol. While searching the Web for "websocket" I have found many popular and good libraries, but just when I was going to give a try one of them, I have suddenly saw the link to "mongoose" library.

After reading some documentation and introduction, I had a feeling that this is exactly what I am looking for! Mongoose developers describe their library as a "embedded web server" and as a "multi-protocol network library". Web-socket is only the part of its functionality, there are several other protocols as well as pure TCP/UDP communication functions that can help to implement any other protocol you wish.

Basically, all that you need to start developing with mongoose can be found in the brief documentation page or on the github repository. It is amazingly easy to use! Just put files "mongoose.c" and "mongoose.h" in you project and include in your application! Check the simple example on the documentation page. It is just 33 lines and you compile it with one line:

# cc myapp.c mongoose.c

Also, there are impressive number of examples can be found in the github repository:

  • Web-socket server and client
  • File upload
  • RESTful server
  • NTP client
  • HTTP client
  • HTTP(s) server
  • and many, many others.

Just go to the example directory and run "make". After example is built, you can play with it.

The source code looks very neat and professional. Though, I did not find any tests in the main repository. May be authors have some set of stand-alone tests and test before they release the code.

It would be nice if mongoose were in the list on wikipedia page "Comparison of WebSocket implementations" or if it could be found if you look for "websocket" on Libhunt. At least it would be helpful for me.

My opinion - mongoose is an amazing portable, cross-platform multi-protocol library! Also,  when I was browsing Cesanta GitHub repository I have found another awesome project. It's JSON parser and generator library, called "frozen". Can be also very useful for web-socket project.

Mongoose is licensed under GPLv2, so If you integrate Mongoose into a commercial product, you are obligated to open your source fully or purchase a commercial license.


Comments

Popular posts from this blog

Asterisk Queues Realtime Dashboard with amiws and Vue

YAML documents parsing with libyaml in C