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.
So the question is, do you have an example about how to use this kind
of communication?
Thanks
-B