I’ve implemented a simple Flex application that tries to connect to a server via the WebSocket protocol. Running the app in the Flash Builder 4.6 debugger everything works fine. So I installed the application on my server and now I get Error #2048 after a while. #2048 seems to be an error concerning security.
The server provides this crossdomain.xml:
Updated
<?xml version="1.0" encoding="UTF-8" ?>
<cross-domain-policy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.adobe.com/xml/schemas/PolicyFileSocket.xsd">
<allow-access-from domain="*" to-ports="*" />
<site-control permitted-cross-domain-policies="master-only" />
</cross-domain-policy>
Edit: It’s provided by calling
Security.loadPolicyFile('http://myserver:8081/crossdomain.xml');
I can see in the web server logs that the client loads it.
I’m using AS3WebSocket as the WebSocket implementation for Flex.
This is how I set up the WebSocket object:
websocket = new WebSocket(url, "*", 'dummy', 5000);
// adding several event handler ...
websocket.connect();
The browser connects to the server with
http://myserver:8081
The url parameter holds
ws://myserver:8081/data
Why does it work locally with the Flash Builder and not on my server? What am I missing?
I got this working. I somehow missed the information that I needed a special policy server running for socket policies on port 843 providing the policy file via TCP.