powered by Jive Software

Really, really could use some help with Messaging

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);

}

I got it working at last by combining several examples:

var connection = new XMPPConnection();

var psce_on:Presence = new Presence( null, null, Presence.AVAILABLE_TYPE, Presence.SHOW_NORMAL, null, 1 );

var user1_msg:Message = new Message("user1@192.168.1.5", null, “Calling User1”, null, Message.CHAT_TYPE, null);

var user2_msg:Message = new Message("user2@192.168.1.5", null, “Calling User2”, null, Message.CHAT_TYPE, null);

public function XMPPconn(): void {

connection.username = “testcase”;

connection.password = “xxxx”;

connection.server = “server.com”;

connection.resource = “xiff”;

connection.addEventListener(LoginEvent.LOGIN, handleLogin);

connection.connect( “flash” );

}

private function handleLogin(event:LoginEvent):void{

connection.send(psce_on);

connection.send(user1_msg);

connection.send(user2_msg);

trace(“Messages sent.”);

}

Hi,

How could you receive the message…? can you retrive the body of the SOAP that is coming?

cheers

Viv