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, January 1, 2012

Sequence of Events

Previously...

  • I fixed an issue with an array growing without bounds
  • I fixed an issue with HTTP headers
  • Things did not work: I resolved to go to a more basic level

Here is what seems to happen when someone connects to ejabberd via BOSH/http-bind:

  • ejabberd_listener:accept accepts the TCP connection
  • ejabberd_listener hands off the connection to ejabberd_socket via the start function
  • (ejabberd_socket considers this a "raw" connection as opposed to an XML connection).
  • ejabberd_socket:start starts up ejabberd_http via the start function
  • ejabberd_http uses the supervisor to start up a new process via start_child.
  • ejabberd_http:init is called as a result of a callback.
ejabberd_http uses a "sockmod" interface in order to receive and send data over the connection.  If I could create a module that provides the same interface but that uses the megaphone protocol, then I would be in business. The tricky parts are that 
  1. ejabberd_http assumes that you have a socket
  2. Inserting the correct socket module into the mix.
The plan is to insert the module either at the point where ejabberd_listener hands control over to ejabberd_socket or at the point that ejabberd_socket hands control off to ejabberd_http.  The next step is to figure out which is the correct place to insert the new module.

No comments:

Post a Comment