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.
Next time, more on the ejabberd/megaphone interface.
No comments:
Post a Comment