Could someone take a look at the code here and let me know what this isn’t connecting to the server and sending the intended message? It’s a known geed server that I connect to using spark with no problem.
Thanks
public function XMPPconn(): void
{
var msg:Message = new Message("riddler@pitchcastmedia.com", null, "Hello World1!", "****
Hello World2!
", Message.CHAT_TYPE, “Hello World3!”);
var connection:XMPPConnection = new XMPPConnection();
connection.useAnonymousLogin = false;
connection.username = “rbottoms”;
connection.password = “xxxx”;
connection.server = “1.2.3.4”;
connection.addEventListener(ConnectionSuccessEvent.CONNECT_SUCCES S, handleConnectSuccess);
connection.addEventListener(IncomingDataEvent.INCOMING_DATA, handleIncomingData);
connection.addEventListener(OutgoingDataEvent.OUTGOING_DATA, handleOutgoingData);
connection.addEventListener(LoginEvent.LOGIN, handleServerLogin);
if(connection.connect(“flash”))
{
connection.send(msg);
}
}
private function handleConnectSuccess(event:ConnectionSuccessEvent):void{
trace(“Connected!”);
}
private function handleServerLogin(event:LoginEvent):void{
var roster:Roster = new Roster;
roster.setPresence(null, “Online”, 5);
trace(“Login event received”);
}
private function handleIncomingData(event:IncomingDataEvent):void{
trace("Received: " + event.data);
}
private function handleOutgoingData(event:OutgoingDataEvent):void{
trace("Sent: " + event.data);
}