cnode.jsembeddedchatlibpurple

Chat *Server* on Embedded platform


I am currently building a chat server (meebo style).

The architecture is something like this.

  1. Bitlbee over libpurple is on host B. Its a trivial server on data center.
  2. User communicates with bitlbee via web server (just like meebo) on Host A. The backend of this web server maintains chat session. It just translates the user commands to proper bitlbee comamnd and sends back to host A.

The most important part here is that host A will be deployed in embedded Linux.

I have 2 questions.

  1. To keep the chat session persistent I am thinking of using . As its much more easier to create a real time application with persistent connection. But I doubt if its supported in such platform.
  2. If I use C instead of node.js (I am not using any web server) I can talk to the irc server at host A by libirc. But how do I implement all the web server features in C (like session, url/cookie/post data parsing etc) ?

Also if you think my approach is wrong or there is a better approach please tell me how can I improve this architecture?

Note: This is NOT a high volume chat server.


Solution

  • If building V8/Node.js is prohibitive on the embedded platform, the next best thing would be to take the event loop and platform layer (libuv) and HTTP parser (http-parser) of Node, both written in C and use those as a starting point. These are the same libraries used to build Node.js so they are battle tested and will give you the performance characteristics you seek.

    Ryan Dahl, author of Node.js, demonstrates exactly how to use libuv and http-parser to build an asynchronous web server in C.