Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetching policy file error connecting to wss endpoint #172

Open
leeyeh opened this issue Jan 20, 2016 · 4 comments
Open

Fetching policy file error connecting to wss endpoint #172

leeyeh opened this issue Jan 20, 2016 · 4 comments

Comments

@leeyeh
Copy link

leeyeh commented Jan 20, 2016

I run into a SecurityError: Error #2048 when connecting to a wss endpoint:

https://rawgit.com/leeyeh/js-realtime-sdk/issue/web-socket-js/demo/web-socket-js/fail.html

[WebSocket] debug enabled
[WebSocket] policy file: xmlsocket://rtm51.leancloud.cn:843
[WebSocket] cannot connect to Web Socket server at wss://rtm51.leancloud.cn:6799/ (SecurityError: Error #2048)
make sure the server is running and Flash socket policy file is correctly placed
Error: Error #1009
[WebSocket] closed

However, if I connect to the same domain over ws: first, everything works fine.

https://rawgit.com/leeyeh/js-realtime-sdk/issue/web-socket-js/demo/web-socket-js/success.html

[WebSocket] debug enabled
[WebSocket] policy file: xmlsocket://rtm51.leancloud.cn:843
[WebSocket] connected
[WebSocket] request header:
GET / HTTP/1.1
Host: rtm51.leancloud.cn:6779
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: ZFFqaXF7LRtYUSwHLkxqZg==
Origin: https://rawgit.com
Sec-WebSocket-Version: 13

[WebSocket] connected
[WebSocket] starting SSL/TLS
[WebSocket] request header:
GET / HTTP/1.1
Host: rtm51.leancloud.cn:6799
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: Gh9eWEMOZl82cy8cVXpsWA==
Origin: https://rawgit.com
Sec-WebSocket-Version: 13

[WebSocket] response header:
HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: loOb+6xIG/TLyLrQkiINFZ3xKFk=

Event {isTrusted: false}

[WebSocket] response header:
HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: WTRZwWqWWbaPIp35Zg5NNbo8as0=

Event {isTrusted: false}

The policy file is served correctly:

echo "<policy-file-request/>" | nc rtm51.leancloud.cn 843      
<cross-domain-policy><allow-access-from domain="*" to-ports="*" /></cross-domain-policy>%
@leeyeh leeyeh changed the title Fetching policy file error connecting to wss Fetching policy file error connecting to wss endpoint Jan 20, 2016
@gimite
Copy link
Owner

gimite commented Jan 20, 2016

Hmm that's weird, but I have no idea why. Have you confirmed that it works fine without WEB_SOCKET_FORCE_FLASH?

@leeyeh
Copy link
Author

leeyeh commented Jan 20, 2016

Yes, it works with native WebSocket implement.

@iuriismirnov
Copy link

Hi guys, same problem. Have you found any solution for this?

@xubaoshi
Copy link

save problem.please tell me why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants