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.

Saturday, December 17, 2011

This is where the Fun Begins

Previously...

  • I changed course from using NXB to handle TCP & HTTP to writing a new program called ECM (external connection manager or is it ejabberd connection manager).
  • I started coding up ECM.
I have since finished coding up the first bits of ECM and they actually seem to do something!  The thing is, they don't do very much.

This not very much bit consists of accepting messages from clients over HTTP and forwarding them on to the server over one TCP connection.  The messages have the form:

    <packet length>|<connection ID>|<content>

Where <packet length> is the length of the entire packet, including the header defined here.  This is a zero padded, 10 digit number, so the size of this field is always known.

<connection ID> is a string that represents a 64 bit connection ID.  The value is zero padded to make it the field size the same regardless of value.  The value is chosen at random.

<content> is the content originally received from the client.  Note that the data is not escaped in any way --- ECM does not care what data is passed in the content.

Now is the point where I have to code up the modified ejabberd module.  As Anakin Skywalker would say "this is where the fun begins."  

The next step is to inject data from ECM into ejabberd in a way that the current BOSH module uses.  Whatever approach I end up using, it needs to "remember" the connection ID so that any response uses that ID when replying.

ejabberd currently uses the HTTP response to "route" the response to the proper client.  This, in turn, used the underlying socket.  A likely course of action is to replace the socket with the ECM connection ID, but I will have to see what things look like on the ejabberd side before implementing anything.

No comments:

Post a Comment