-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
How do I do functions shown in SSLClientExample in JavaScript? #1080
Comments
Hey @jpaulm, the code in the SSLClientExample is necessary, if you use a self signed certificate and you want to trust this. The self signed certificate is saved in the keystore and most of the code is just to get the sslcontext for that self signed certificate. If you are connecting to a trusted certificate, you can do it without all that code. Just pass wss://address:port as url and you are good to go. For the server it is a bit more difficult since the server will need the private key of your certificate. For the javascript client, it also depends on your certificate. If you use a trusted certificate, you can simple connect to the server with wss://address:port. Best regards, |
That's a great help - thanks, Marcel! Looks like one option is colon after the double slash - I haven't run into that before! I can't even find a definition for it using Google...? |
I think markdown did screw with me. I edited my post Sorry |
Many thanks, Marcel! I don't know much about trusted and/or self-signed certificates, so I had better do some reading! I followed some "recipes", but they are not much use if I don't really know what I'm doing! The weird thing is that I did find a reference to Thanks, and regards |
Sorry to bother you - but I just need a direction! I am trying to test wss: in my JavaScript/HTML client, and it just dies on the chatclient.send! No error message or anything! I know it reached the "send", but I have no idea what state it is in after that! So I am just wondering if you could point me at a debugging tool, error test, listener, or whatever, so that I could resume testing...! I am completely stuck at this point! I know very little about JS, but my test case with ws: does work! It is only the wss: case that gives me trouble! Many thanks in advance! |
@jpaulm Try using the developer console (Ctrl+Shift+i) and check the console for any errors or warnings. |
Fantastic! That's excellent - thanks so much, Philip! |
@marci4 Came across your Oct. 10 comment: "If you are using a self signed certificate, you have to trust it e.g. by adding the certificate to your trusted certificates or open the websocket url with https:// instead (https://address:port). The browser will report an error for the certificate but you are able to trust it in this dialog as well." Just figured out how to do this, and it gave me a message of 404 Websocket Upgrade Failure , so I guess i will try the first alternative... Just to verify: I can do this with JavaScript clients, right? Very little info out on the 'net... Thanks! |
@jpaulm Note that |
@jpaulm that is expected but the only way to trust the self signed certificate I know (without flags or adding it to the os certificate store) |
Thanks for your prompt answers, @noahandrews and @marci4 ! I managed to get my certificate trusted, so things seem to be working... with Chrome, but not with Firefox, though - I seem to remember reading that somewhere that Firefox is different, but I'm not sure how or why (it gives a message of "An established connection was aborted by the software in your host machine" and crashes!)...? |
Looking at SSLClientExample, I see the main line has key management code, etc., which is almost the same as that shown in SSLServerExample... so my questions are:
a) does this code need to be in both places, and
b) if it needs to be in the client, how do I do that in JavaScript (my client is JavaScript invoked by HTML)?
Thanks! Apologies as this is probably a dumb question!
The text was updated successfully, but these errors were encountered: