My next steps:
- Use OpenFire locally as the server
- Write code that will do what I do with mesh4x
- Hook it into Google Maps
Basic code:
XMPPConnection connection = new XMPPConnection("jabber.iitsp.com");
connection.connect();
connection.login(userName, password);
Chat chat = connection.getChatManager().createChat(person, new MessageListener() {
public void processMessage(Chat chat, Message message) {
System.out.println("Received message: " + message.getBody());
}
});
chat.sendMessage("Hi there!");
I do a bit more in my code to keep the thread running and to recognize who the user is and respond with a customized message but this is the code that actually sends and receives the message. This is taken from the Smack documentation as a basic test. If you want to just test it one way, create an account at Trillian using XMPP as the protocol with one of your user accounts: user1@jabber.iitsp.com. Then set up your Java code as user2 who wants to send to user1. Your trillian client will pop up your message.
No comments:
Post a Comment