gimite / web-socket-js

HTML5 Web Socket implementation powered by Flash
BSD 3-Clause "New" or "Revised" License
2.73k stars 489 forks source link

Policy file should be requested form the actual websocket host, not from the server the html is hosted on #42

Closed BonsaiDen closed 13 years ago

BonsaiDen commented 13 years ago

At the moment loadPolicyFile defaults to the server the HTML document is hosted on, which, like in my case, isn't the server that the actual server is running on( HTML is on Dropbox, the server is running on my local computer).

Therefore I can't connect to my server at bonsaiden.dyndns.org:28785 since flash requests the policy from dl.dropbox.com:843, which is clearly wrong.

Simple fix is to change the parameter of the initial loadPolicyFile(null) (WebSocketMain.as:54) call when creating a socket to loadPolicyFile(URLUtil.getServerName(url)), now flash correctly requests the policy from bonsaiden.dyndns.org:843 and everything works like a charm.

gimite commented 13 years ago

Thanks for the report. Fixed at: http://github.com/gimite/web-socket-js/commit/8ec2933c9ec24be18119f699866b91e4a8c7b2a1 Not sure why I implemented in that way :)