mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bernd Fondermann <bf_...@brainlounge.de>
Subject from addresses c2s [Re: [vysper][pubsub] Realworld demo with realworld client]
Date Sat, 04 Jul 2009 22:34:45 GMT
Bernd Fondermann wrote:
> Michael Jakl wrote:
>> Hi!
>>
>> I've been trying to implement a demo application for my publish/subscribe
>> extension. My experience so far is all but rosy, in fact I'm tearing my hair
>> out.
>>
>> Let me explain what I did so far:
>>
>> I've tried basic usage of the server with Pidgin and Gajim, both cannot connect
>> to the server due to XML parse errors or programming errors? Pidgin is
>> widely used
>> and Gajim includes support for the pubsub extension.
>>
>> Smack to the rescue! Using smack I could connect to the server and send a few
>> messages back and forth. As soon as I switch to the pubsub extension for
>> smack[1] the whole thing breaks down again.
>>
>> Let me show a small part of the code I wanted to write (c1 and c2 are
>> XMPPConnections, one for user1 and one for user2):
>>
>>  PubSubManager psm1 = new PubSubManager(c1);
>>  PubSubManager psm2 = new PubSubManager(c2);
>>
>>  // create test node by user1
>>  Node test1 = psm1.getNode("test");
>>  test1.subscribe("user1@vysper.org");
>>
>>  // subscribe user2 to test node
>>  Node test2 = psm2.getNode("test");
>>  test2.subscribe("user2@vysper.org");
>>
>>  // user1 publishes some item
>>  Item<PublishItem> item = new Item<PublishItem>("something");
>>  test1.send(item);
>>
>> In plaintext:
>>  - user1: create a node "test"
>>  - user1: subscribe to "test"
>>  - user2: lookup "test"
>>  - user2: subscribe to "test"
>>  - user1: send a message to "test"
>>  - user1: receive notification (not shown)
>>  - user2: receive notification (not shown)
> 
> Seems all good to me.
> To avoid making this a smack pubsub extension debugging project you
> could send plain stanzas using the barebone smack API.
> 
>> The problem starts with the subscribe request. It seems that Vysper
>> does not add the "from" address
>> of the sender (see RFC3920, 9.1.2) to the stanzas.
> 
> Maybe you could write a simple unit test for that?
> This should be an easy thing to fix.
> Could you open a JIRA for that, please?

After a quick(!) review, I found that the /client/ is required to send a
'from' address /only/ if it has bound more than one resource at the same
time (rare).
In all other cases, the from is available in the handler via
SessionContext.getInitiatingEntity(). So it is not necessary to enrich
the stanza while it is still in the handler.

Now, where do you expect the server to add the from, when it currently
doesn't?

<snip/>

  Bernd

Mime
View raw message