[jdev] Question about Jabber principles

Peter Saint-Andre stpeter at jabber.org
Mon Mar 20 11:31:58 CST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andrew Plotkin wrote:
> I am working on a small piece of our Volity project, and I see several
> ways to do it. They'll all work, but I'm not sure which is most in tune
> with the zen of Jabber.
> 
> What I want to do is send a game invitation as part of a <message>.
> (Could be either IM or group-chat.) This is a set of fields; if one of
> our Volity clients receives it, the invitation will be displayed with
> appropriate UI ("Do you want to join this game? [] yes [] no" and so
> on.) If a generic client receives the message, it should ignore the
> invitation part and display it as a standard message.
> 
> So option 1 would be to define some new protocol, maybe with a JEP (if
> any other clients want to handle the invitation info), and stick the
> fields directly into a custom element:
> 
> <message to="..." from="..." type="normal">
>   <body>Play a game!</body>
>   <invitation xmlns="http://volity.org/protocol/invite">
>     <table>...</table>
>     <referee>...</referee>
>   </invitation>
> </message>
> 
> (There are more fields than that; I'm simplifying here.)
> 
> This is fine, except that we may add or redefine fields as we expand our
> goals. And I don't want to change the XML schema every time that
> happens. Okay, Jabber has a way to handle that, which is data forms. So,
> option 2:
> 
> <message to="..." from="..." type="normal">
>   <body>Play a game!</body>
>   <invitation xmlns="http://volity.org/protocol/invite">
>     <x xmlns="jabber:x:data" type="result">
>       <field var="table"><value>...</value></field>
>       <field var="referee"><value>...</value></field>
>     </x>
>   </invitation>
> </message>
> 
> But then I notice JEP-0068, and I think maybe I can do this without any
> custom protocol at all. Option 3:
> 
> <message to="..." from="..." type="normal">
>   <body>Play a game!</body>
>   <x xmlns="jabber:x:data" type="result">
>     <field var="FORM_TYPE" type="hidden">
>       <value>http://volity.org/protocol/form/invite</value>
>     </field>
>     <field var="table"><value>...</value></field>
>     <field var="referee"><value>...</value></field>
>   </x>
> </message>
> 
> So our client watches for a result form of the appropriate FORM_TYPE,
> and other clients ignore the extraneous (to them) form.
> 
> Which of these is most friendly to the Jabber system? We've gotten this
> far by using existing JEPs, so I have a slight preference to *not*
> introduce new Jabber protocol. But I'm more interested in figuring out
> what will work right with existing and future Jabber software.

I'd say a combination of 2 and 3 is best. That is, leave in the wrapper
element (<invitation/>) so that standard Jabber clients can ignore your
stuff based on namespace, then lock in the meaning of the data fields
using JEP-0068 scoping.

Peter

- --
Peter Saint-Andre
Jabber Software Foundation
http://www.jabber.org/people/stpeter.shtml

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEHucONF1RSzyt3NURAjwhAJ9s++Tu+qX7ELAWlhQGCOoC3QLywACfaqzs
y5+1K9SjVOmtTNAe0yXHuTc=
=/edb
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3641 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://www.jabber.org/jdev/attachments/20060320/6f8629f3/attachment-0002.bin>


More information about the JDev mailing list