powered by Jive Software

Connection failed on webserver

I have created an application and it all works fine when testing within Flash and also when running the SWF in the flash player. When I uploaded the SWF to my website it is failing to connect to the jabber server,as i can’'t trace anything I am not sure what it is doing or where it is failing.

Does any one have any ideas why this might be happening?

It appears you are another victim of the Flash security sandbox You can only connect to a server that is residing on the same domain as the SWF.

See this thread for info on getting around it if you can’'t host the server on the same domain:

http://www.jivesoftware.org/forums/thread.jspa?messageID=96417&#96417

Hi, Thanks for the link.

I have tried adding a crossdomain.xml file, and I also tried a System.security.loadPolicyFile() refering to another, but still no connection. I created a new SWF that traces all event listeners events to a text field. It stops when while trying to execute the connection.connect(“flash”);.

So I am assuming that it is still not been granted access to the external domain. Any ideas anyone?

Here is what I have tried. I also tried just the line load(“www.xxxxxxx.com/crossdomain.xml”) instead of the load sucess stuff.

//

import org.jivesoftware.xiff.data.Message;

import org.jivesoftware.xiff.core.XMPPConnection;

import org.jivesoftware.xiff.im.Roster;

//

var my_lv:LoadVars = new LoadVars();

my_lv.onLoad = function(success:Boolean) {

if (success) {

_root.mess.text = _root.mess.text*"\r"*“Cross Domain Loaded”;

doLogin()

} else {

_root.mess.text = _root.mess.text*"\r"*“Error loading cross domain.”;

}

};

//

my_lv.load(“http://www.xxxxxxxx.com/crossdomain.xml”);

//

var connection = new XMPPConnection();

connection.username = “xxxxxx”;

connection.password = “xxxxx”;

connection.server = “jabber.org”;

//

_root.mess.text = “MOVIE LOADED.”;

//

var roster = new Roster(connection);

//

// Event handler

eventHandler = new Object();

eventHandler.handleEvent = function(eventObj) {

switch (eventObj.type) {

case “outgoingData” :

trace(“OUTGOING”);

_root.mess.text = _root.mess.text*"\r"*“OUTGOING”;

break;

case “incomingData” :

trace(“INCOMING”);

_root.mess.text = _root.mess.text*"\r"*“INCOMING”;

break;

case “rosterUpdate” :

//trace(“ROSTER CHANGE”);

break;

case “login” :

trace(“Logged in”);

_root.mess.text = _root.mess.text*"\r"*“Logged in”;

break;

case “message” :

trace(“message”);

_root.mess.text = _root.mess.text*"\r"*“message”;

break;

case “registrationFields” :

trace(“REG FIELDS”);

_root.mess.text = _root.mess.text*"\r"*“REG FIELDS”;

break;

case “registrationSuccess” :

trace(“REGISTATION SUCCESS”);

_root.mess.text = _root.mess.text*"\r"*“REGISTATION SUCCESS”;

break;

case “disconnection” :

trace(“DISCONNECTION”);

_root.mess.text = _root.mess.text*"\r"*“DISCONNECTION”;

break;

case “connection” :

trace(“CONNECTION”);

_root.mess.text = _root.mess.text*"\r"*“CONNECTION”;

break;

case “error” :

trace("ERROR “eventObj.errorCode”: "+eventObj.errorMessage);

break;

case “userAvailable” :

trace(“userAvailable”);

_root.mess.text = _root.mess.text*"\r"*“userAvailable”;

break;

case “userUnavailable” :

trace(“userUnavailable”);

//checkForChanges();

break;

}

};

connection.addEventListener(“registrationFields”, eventHandler);

connection.addEventListener(“registrationSuccess”, eventHandler);

connection.addEventListener(“outgoingData”, eventHandler);

connection.addEventListener(“incomingData”, eventHandler);

connection.addEventListener(“login”, eventHandler);

connection.addEventListener(“rosterUpdate”, eventHandler);

connection.addEventListener(“message”, eventHandler);

connection.addEventListener(“disconnection”, eventHandler);

connection.addEventListener(“connection”, eventHandler);

connection.addEventListener(“error”, eventHandler);

roster.addEventListener(“userAvailable”, eventHandler);

roster.addEventListener(“userUnavailable”, eventHandler);

//

function doLogin() {

_root.mess.text = _root.mess.text*"\r"*“Try to connect”;

connection.connect(“flash”);

}

Message was edited by:

iainfreestone

You do not need to try to load the crossdomain.xml file with LoadVars, or XML.load() in order for the Socket connection to work. It is kind of like a catch 22 the way you have it now: You are trying to test for the loading of the crossdomain XML file, but won’'t be able to load the crossdomain XML file without the crossdomain XML file properly configured to let you load the crossdomain XML. Wow, that is confusing! Flash just does the check for you behind the scenes without you, the programmer, needing to do anything, so in your example this is totally unnecessary.

Can you send an example of what your particular crossdomain file looks like? Is it hosted in the root directory of port 80 on the same machine/domain that is running the XMPP server?

Also, you may want to simplify things at first by creating a crossdomain.xml file that allows any domain to access it. Here is an example of that:

<?xml version="1.0"?>

I hope some of this helps.

-Chris

Hi thanks, I have taken the test out now but still no luck.

I am trying to access data from jabber.org and I have checked www.jabber.org/crossdomain.xml and from my understanding I should be able to send data their server.

So this is what i have:

A crossdomain xml file on jabber.org which contains:-

A crossdomain xml file on my server which conatins:-

<?xml version="1.0" ?>

I would love to get this working and have tried changing the xml to just about everything i could think of but nothing.

Same problem here, I can connecto from flash but no from my website, anybody has any idea?

the problem, just with jabber.org is in this thread

http://mail.jabber.org/pipermail/jdev/2005-January/019948.html

Note than ETA is Estimated Time of Arribal, the issue is pending. The posta is from jan 5 2005 and still unresolved.

Regards