What is Megaphone?

What is Megaphone?
The Megaphone project is about enhancing open source chat software. Specifically, the goal is to allow ejabberd to support 1,000,000 simultaneous users. See The Plan page for more details on how I plan to solve this problem. See the About this Blog page for more details on why I created this blog.

Sunday, December 25, 2011

mod_megaphone Changes

Previously...

  • I decided to use a new, new plan.
  • I analyzed the function handle_http_put in the existing code.
  • I decided to skip further analysis and go straight to coding.
Coding up the ability to start up a new process, call ejabberd_http_bind:process_request and waiting for a reply proved very straight-forward.  The hard part is formatting the response for the client. 

According to wireshark, an HTTP response has the following form:


HTTP/1.1 200 OK
Content-Length: 1961
Content-Type: text/xml; charset=utf-8
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Content-Type

content...

Each line must be terminated with a carriage-return, linefeed combination.  process_request actually returns most of the headers so the only work is formatting the first line, formatting the Content-Length line, and ensuring that everything uses the proper carriage-return/linefeed combos.


I am currently slogging through getting all the formatting correct.  Hopefully for next time I'll have something interesting to say.

No comments:

Post a Comment