gimite / web-socket-js

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

wss doesn't work #28

Closed daralthus closed 13 years ago

daralthus commented 14 years ago

Hey there! A secure connection support would be awesome, I did the homework and found http://github.com/kanaka/noVNC he has a modified version of web-socket-js but I can't get it to work, There's no FAB init callback with https and wss. Hopefully you could do it. :)

gimite commented 14 years ago

Sorry wss support is implemented by a contributer Joel Martin http://github.com/kanaka and I haven't tried it myself. I also heard that it sometimes doesn't work from another person. If you ask Joel, he may give some hint.

gimite commented 14 years ago

I believe I fixed the issue. Please pull the latest version and try again.

It seems trustSelfSignedCertificates, the flag I used, accepts only self-signed certificates but not officially signed certificates. I switched to trustAllCertificates. http://www.google.com/codesearch/p?hl=ja#4__iCOd2LuI/trunk/as3crypto/src/com/hurlant/crypto/tls/TLSEngine.as&q=trustSelfSignedCertificates&sa=N&cd=1&ct=rc&l=804

daralthus commented 14 years ago

Hmm, I used self-signed before.. :) Anyway i tried out but nothing with https.. Does it work for you? There is no trace of it in the console. Before this with an older version an "https:" message appeared but no followup, now even that is missing.. :D

gimite commented 14 years ago

I actually haven't tried myself. So it may have another issue... Did you confirm that it works with Chrome? If not, something is wrong with your configuration or code, not web-socket-js, because it just uses native WebSocket implementation in Chrome. "https:" message was just debug message submitted by mistake, so it's expected that it has disappeared in latest version.

daralthus commented 14 years ago

yes, I tried it works in chrome with both http and https and works in firefox too but only with http. actually the first debugging message is still "http" on http connections :) anyway I tried it with different ports and secure connection. the problem seems to be before any communication. there is no fab inited message... and I get no policy errors when I should.

gimite commented 14 years ago

You mean https+wss doesn't work but http+wss does work as well as http+ws? (Here https+wss means your HTML file is at https://... and it connects to WebSocket server at wss://...) Then there might be some restriction specific to running SWF hosted at https... Do you put both of your HTML file and SWF file at https://....?

daralthus commented 14 years ago

ok so here are the results: when http + wss, the wss host is 127.0.0.1:3000 the console drops a can not connect (ioerror) when http + wss at 127.0.0.1 and the policy allowed for port 443 there's a policy error when http + wss at 127.0.0.1 and policy allowed for 80 console says "[WebSocket] starting SSL/TLS [WebSocket] request header: GET /testsomefeatures HTTP/1.1 Upgrade: WebSocket Connection: Upgrade Host: 127.0.0.1 Origin: http://127.0.0.1 Cookie: Sec-WebSocket-Key1: 51d 80u 4 Z.) *3c9f v) 44 Sec-WebSocket-Key2: >7 8/ ^ V H766' V!,0 2/9 [WebSocket] sent key3: 3¨n×Á· [WebSocket] closed" with https there is no attempt shown in the console so you must be right cuz I am serving the swf with the https server, but wss don't seems to work over http too. (Well actually that can be becouse of the different origin types...) Later I will try serving static files over http to see what happens.

kanaka commented 14 years ago

daralthus: Are you still having this problem? If you have figured out the problem can you indicate as much? If you are still having the problem, can you indicate what your WebSockets server is?

BTW, I use wss successfully with web-socket-js and wsproxy (utility with noVNC).

nerf commented 13 years ago

I just implemented wss support on my server (http + wss) and web-socket-js is working so far.

gimite commented 13 years ago

Closing for now. Please reopen if anyone still see the issue.

GiKyouGetsu commented 4 years ago

Hi @daralthus I get the same issue with this web_socket.js: https + wss, and the policy allowed for port 443 there's no policy error, but I can not open the scoket connection. how do you fix the issue?