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, March 11, 2012

Anything is Better than Nothing

Previously...
  • I discovered a correction for a previous correction.
  • I analyzed ways of calling ejabberd_http_bind.
  • I decided on using ejabberd_http_bind:process_request.

I have been stymied by the following question: how does data get back to the user through megaphone?

After trying to figure things out by using the precognitive power of beer I came to the conclusion that beer is very bad at helping me figure out code.  I then went on to try and use my old postings from this blog to guide my decision.  This worked a little better then beer, but when combined with perusing the source code I finally hit upon an answer: I was tired of sitting around and looking at code.

Well, it's not quite that bad, but I did decide that process_request probably only returns when it has something to "say" to the user.  This is the same approach that BOSH uses with HTTP POSTs: the user makes a POST to the BOSH URL and the server responds when it has something.

My new plan is therefore:
  • When megaphone gets a request from ECM, it starts up a new process.
  • The new process calls ejabberd_http_bind:process_request with the data.
  • When ejabberd responds to the call (via a return), it sends the data onto ECM.
  • The new process terminates.
  • Hope that this works.
While I'm not sure this will actually work, I have come to the conclusion that any action is better than no action.  Fools rush in and all that...sigh.

Next time: (hopefully) first bits of code to call process_request.


No comments:

Post a Comment