[JDEV] client to client communication using jabber?

Matt Tucker matt at jivesoftware.com
Fri Jan 3 16:47:06 CST 2003


I've been working on an Open Source Jabber library for Java and have
implemented functionality similar to what it sounds like you'd want.
Perhaps you could use a similar idea for your implementation.

For each packet, you can add an arbitrary number of properties. A
property has a String name and value. The value can be any "primitive"
type such as an integer, boolean, double, or String, or can be any
Serializable Java object. Since you can add anything you'd like in an
<x> element, the server will pass it along between clients, and it's up
to them to know how to interpret the data.

Here's what it looks like over the wire:

<!-- The following x element would be inside a packet, such as a message
<x xmlns="jabber:x:properties">
  <!-- First, a property named "prop1" that's an integer. -->
    <value type="integer">123</value>
  <!-- Next, a Java object that's been serialized and then converted
       from binary data to base-64 encoded text. --> 
    <value type="java-object>adf612fna9nab</value>

>From an API perspective, it would be something like:

 Message message = new Message();
 message.setProperty("prop1", 123);
 message.setProperty("prop2", new FooObject());

There's nothing official about this format at this point, but it's
worked well so far. If it proves useful, I may submit it as a JEP.


> -----Original Message-----
> From: jdev-admin at jabber.org [mailto:jdev-admin at jabber.org] On 
> Behalf Of Pat Magnan
> Sent: Friday, January 03, 2003 5:07 PM
> To: jdev at jabber.org
> Subject: [JDEV] client to client communication using jabber?
> Brief description of what we're trying to do:
> - our project is a Bridge Bidding tool, it allows two players 
> to 'practice' 
> bidding hands over the Internet
> - we decided to use the JabberCom object, and use it for our 
> embedded chat 
> client (so they can discuss things from within the program)
> - when I saw I could send XML strings using Jabber, I thought 
> I'd use that 
> also for one client to talk to the other one (passing strings 
> representing 
> each player's hand of cards, what bid they're making, and so on).
> I'm having a little difficulty working out if it is even 
> possible to send 
> my own (somewhat limited) dtd or basically arbitrary data from one 
> client/jid to the other (I don't care if it has to go through 
> the server, I 
> just want the server to forward it to the other client). 
> Actual messages 
> are no problem, but the documentation doesn't clearly guide 
> me as to how to 
> do that (much of it being in the form of proposals I guess so 
> I'm trying to 
> do things that aren't implemented it seems).
> I've seen things like jabber:x:data - which sounds like it 
> would do, or 
> jabber:something:oob. The protocol document was a good start, 
> where do I go 
> from here?
> The two clients can message successfully, so, it's a matter 
> of working out 
> how to send xml from one to the other (assuming I can) that 
> contains my 
> application's data.
> Any pointers or references that google isn't turning up for 
> me that anyone 
> can think of?
> Thanks,
> _______________________________________________
> jdev mailing list
> jdev at jabber.org
> http://mailman.jabber.org/listinfo/jdev

More information about the JDev mailing list