On Wed, Mar 21, 2012 at 21:27, Bernd Fondermann
<bernd.fonderm...@googlemail.com> wrote:
> On Wed, Mar 21, 2012 at 17:41, Boniface Millian
> <boniface.mill...@gmail.com> wrote:
>> Hi everybody,
>>
>> I am playing with Vysper and I stumbled upon the StanzaSessionContext
>> class which is described as  "a session running in the server VM based
>> on using Vysper's built-in {@link
>> org.apache.vysper.xmpp.stanza.Stanza} object. this is an unconvential
>> use, it does not rely on a network connection."
>>
>> AFAIU, this class might be used to implement a client that
>> communicates directly with the server using the Java API.
>>
>> This is very interesting because such a feature might be used to
>> implement a system that integrates Vysper and uses it to deliver
>> messages (e.g., notifications) to the client connected to the server.
>>
>> So I tried to the following thing: start a simple Vysper server,
>> connect to it via some Pidgin clients and use a StanzaSessionContext
>> to programmatically send messages to the connected (Pidgin) clients.
>>
>> To be more specific, after server.start() I initialize a 
>> StanzaSessionContext:
>>
>> ServerRuntimeContext context = server.getServerRuntimeContext();
>> StanzaSessionFactory ssf = new StanzaSessionFactory();
>> ssf.setServerRuntimeContext(context);
>> StanzaSession session = ssf.createNewSession();
>>
>> And then I start to periodically send messages to "us...@vysper.org":
>>
>> session.send(StanzaBuilder.createMessageStanza(server.getServerRuntimeContext().getServerEnitity(),
>> EntityImpl.parse("us...@vysper.org"), "en", "Hello!").build());
>>
>> I connect with Pidging as us...@vysper.org but no messages are ever received.
>>
>> I also activated the DEBUG level logging and I noticed that
>> session.send(...) doesn't generate any message. I suspect that there
>> are other steps that must be performed in order to have a functional
>> local StanzaSession.
>
> you're right. you need to complete the full XMPP handshake as defined
> by the XMPP RFCs.

BTW, you probably in addition need to make both users known contacts
by mutually subscribing each others presence before messages go
through.

  Bernd

Reply via email to