[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [JDEV] Transport Communication..



> 	I've got a silly question..

The most important kind! (seriously, many don't ask silly questions
because they think they are just missing something but are really
something everyone is wondering :) 

> 	Why are transports communicating with jabberbox the way they are?  Why not
> make the transport<->jabberbox protocol more like the client<->transport
> prototol, but use <jabberbox> instead of <jabber>??

Long answer or short answer?

Short answer: if it _wasn't_ encapsulated in CDATA secions, that means
that (by definition) it would all have to be parsed into memory then
recreated into strings, when the original and final are identical.  For a
busy JabberBox I wouldn't consider this a simple task :)

Long answer: JabberBox acts as an independant data "router" that just
transfers those CDATA chunks as strings reading/writing to different
sockets and understanding addressing... when an internet router moves
packets around, it just looks at the headers and sends the data chunks on,
this is a similiar scheme.  The only safe way to do this in XML is to use
the special <![CDATA[asdfasdf]]> sections as the containers for the data
chunks.

Look at this as a feature, being that JabberBox can be used in a more
general purpose fashion... because of this speration of routing and data,
you can connect as a transport and send another transport ANY strings you
want, it doesn't have to be XML, or leagl XML, so long as the sender and
recipient understand it.

> 	I've been messing with the perl XML::Parser module, and in order to parse
> messages, I need to basically catch the Char data within the default handler
> becouse it's within the <![CDATA[ thingy (Highly technical term, isn't
> it..).  Why do it this way?

Yes, all transports will have to employ two parser instances, one to parse
the JabberBox routed packets, and one to parse the actual packet that was
delivered.  Once you understand this, it doesn't turn out to be that
difficult, just a little different.

Thanks for asking though... this stuff needs to become part of the docs!

Jer