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 22, 2012

What ejabberd Wants



Previously...
  • I created the part that receives headers.
  • I finished the receiver
  • I created the sender

The next part is the megaphone module itself.  This needs to do two major things:
  • Present a consistent interface to ejabberd_http and ejabberd_http_bind.
  • Buffer data.
The existing ejabberd BOSH module (ejabberd_http_bind and to some extent ejabberd_http) use a sort of generic socket module for communicating with the client.  The functions that I have found that need to be implemented are:
  • peername
  • recv
peername is used by ejabberd when determining "X-Forward-For."  It is not clear to me why ejabberd would care about which servers are forwarding packets on behalf of what other servers.  For the time being, I'm going to focus on getting megaphone to simply work, so this function is simply defined thusly:


peername(_Socket) ->         

    {ok, {{127, 0, 0, 1}, 1234}}.

The recv function ties in with data buffering.  Interestingly, the BOSH portion never seems to receive any data, instead ejabberd_http is the part that does this and the data is simply passed on to the BOSH part.

Next time, more on the ejabberd/megaphone interface.


No comments:

Post a Comment