On Wed, Mar 28, 2012 at 22:51, Boniface Millian
<[email protected]> wrote:
> On Thu, Mar 22, 2012 at 11:13 AM, Bernd Fondermann
> <[email protected]> wrote:
>> On Thu, Mar 22, 2012 at 10:47, Boniface Millian
>> <[email protected]> wrote:
>>> On Wed, Mar 21, 2012 at 11:27 PM, Bernd Fondermann
>>> <[email protected]> wrote:
>>>> On Wed, Mar 21, 2012 at 21:27, Bernd Fondermann
>>>> <[email protected]> wrote:
>>>>> On Wed, Mar 21, 2012 at 17:41, Boniface Millian
>>>>> <[email protected]> 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 "[email protected]":
>>>>>>
>>>>>> session.send(StanzaBuilder.createMessageStanza(server.getServerRuntimeContext().getServerEnitity(),
>>>>>> EntityImpl.parse("[email protected]"), "en", "Hello!").build());
>>>>>>
>>>>>> I connect with Pidging as [email protected] 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.
>>>>
>>> Thanks for your answer...
>>>
>>> Indeed, by sending some stanzas as it's done in the
>>> org.apache.vysper.stanzasession.StanzaSessionTestCase.testHandshake()
>>> makes the server respond.
>>>
>>> Basically I would need to re-implement all protocol interactions that
>>> are needed for implementing my use-cases. Which is quite painful
>>> considering that all these interactions are already available in
>>> libraries like Smack, if socket communication is used :)
>>
>> Painful? Well, I don't know. Coding is fun, isn't it?
>>
> Actually it is (fun) :)
>
>> You could record all the stanzas as text, as sent by a remote Smack
>> client (in a text file, for example) and just replay them to the
>> StanzaSession instance.
>>
>> Anyway, alternatively you could employ Smack within the Server JVM, too.
>>
> Well, the point was to avoid to use the TCP/IP stack when the server
> is accessible via method calls.

You can avoid using TCP/IP, but you cannot avoid using XMPP when
talking to a XMPP server.

  Bernd

Reply via email to