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 :) Thanks again, -B > BTW, you probably in addition need to make both users known contacts > by mutually subscribing each others presence before messages go > through. > > Bernd
