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.

Monday, December 12, 2011

NXB and Features

Looking through the NXB code, I think I have identified the part where a response is sent to the initial request from the user, or at least from the client on behalf of the user.  In bosh.js there is the following fragment:


if (helper.is_session_creation_packet(node)) {
  log_it("DEBUG", "BOSH::Session creation");
  session = session_store.add_session(node, res);
  stream = stream_store.add_stream(session, node);


  // Respond to the client.
  session.send_creation_response(stream);


The bit that invokes send_creation_response is the part that needs to be deferred in the case of Pidgin until the XMPP server responds with a list of features.  From looking around it seems that session.enqueue_response is responsible for at least queuing up the response that will be delivered to the user.

It seems reasonable to me that what could happen is that, at the point where the the send_creation_response occurs, the system could instead set a flag that the creation response needs to be sent.  The enqueue_response could then check for the flag and send out the creation response stanza along with the features.

Given my track record, I'm probably wrong.

But hey, it's a place to start.

No comments:

Post a Comment