-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
ws on ssl not working #257
Comments
I've been seeing this issue with the client myself recently too. Using node v0.10.20 I've been seeing the "Reserved fields must be empty" error when switching to https. When using http it works fine. Also, I've tried changing the server from pure node to pure sinatra to sinatra proxied by nginx to node proxied by nginx and the client error message is the same regardless of the server configuration. It looks like some other people were having similar issues earlier in this thread (nodejs/node-v0.x-archive#5557) with socket.io. I'm not sure if socket.io uses ws but even if not maybe they're parsing data the same way? |
Works for me. We're using [email protected] and [email protected] and [email protected] |
Which client are you using? I've had problems in mobile Safari when the browser would not connect to a secure websocket connection because I was using a self signed cert. |
I'm having issues using [email protected] and [email protected] and [email protected] The client gets an immediate disconnect with nothing but a
I'm able to curl OK on 443:
I have tried If I add to the .bin/wscat file
I get a disconnect like on the client side:
|
I had an issue with passing could @aembke be right (#257 (comment)) on similarity to nodejs/node-v0.x-archive#5557? since this seems Chrome-only I would guess protocol related? other theories http://code.google.com/p/go/issues/detail?id=6121 theturtle32/WebSocket-Node#88 (comment) |
I'm also seeing the |
Here's the SSL error I'm getting
|
Boom. Found the issue, had to add the CA bundle to the options object, instead of bundling them into my cert. So
becomes
|
That's how I got past my initial problems as well. Next thing to check: Does it work in Chrome and not just on the command line or in FF? |
You're right, looks like I celebrated too soon. hmm.. |
You're the first person to verify my issue report, so - thanks! But yeah, this library is not production ready w/o Chrome support. I'm not the best person to offer his time but will do so regardless. If anyone can point me to where I should poke around for this issue, I'd love to use this library in my application and would be happy to spend some time on making Chrome work. |
I loaded up wireshark to have a closer look and it began working. Very odd.. |
Hi, Thanks, |
I got it working, I wrote about it here for anyone interested: http://www.chovy.com/web-development/self-signed-certs-with-secure-websockets-in-node-js/ |
@chovy Any suggestions on connecting to a server (that uses a self-signed cert) from another server? (eg: another NodeJS process) var WebSocket = require('ws');
var ws = new WebSocket('wss://192.x.x.x:4443', '', {
headers: {token: 'xxxxxx'}
}); I can connect to my server from Google Chrome, but not from the terminal.
EDIT: Figured out how to allow self-signed certs (never use this in production): // Do this before calling `new WebSocket` on the client server (not the websocket server).
process.env.NODE_TLS_REJECT_UNAUTHORIZED = 0; |
@aleclarson You can also use the Closing this as it seems everything has been addressed/solved. |
I run this in the server side. The client can't connect and it doesn't shows errors.
var cfg = {
};
var httpServ = ( cfg.ssl ) ? require('https') : require('http');
var WebSocketServer = require('ws').Server;
var app = null;
// dummy request processing
var processRequest = function( req, res ) {
};
if ( cfg.ssl ) {
} else {
app = httpServ.createServer( processRequest ).listen( cfg.port );
}
var wss = new WebSocketServer( { server: app } );
wss.on('connection', function(ws) {
console.log("Connected!");
ws.on('message', function(message) {
console.log('received: %s', message);
});
ws.send('something');
});
In the client side, I use:
socket = new WebSocket("wss://192.168.1.34:8080");
The text was updated successfully, but these errors were encountered: