tv icon indicating copy to clipboard operation
tv copied to clipboard

WebSocket connection fails on HTTPS

Open malsher opened this issue 9 years ago • 7 comments

TV is unable to make a secure websocket connection over https, reporting the following error:

WebSocket connection to 'wss://05745327c4b9:55044/' failed:
Error in connection establishment: net::ERR_NAME_NOT_RESOLVED

The error points to line 43 of app.js which reads:

var ws = new WebSocket(protocol + host + ':' + port);

malsher avatar Dec 20 '15 04:12 malsher

could you try setting yourself the host property of Tv when registering the plugin?

osukaa avatar Dec 20 '15 16:12 osukaa

Are you using this inside a docker container?

osukaa avatar Dec 22 '15 15:12 osukaa

Yes, inside a Docker container. Setting the host property doesn't appear to help, which could be related to being inside a container.

malsher avatar Dec 22 '15 18:12 malsher

Do you have the 55044 port mapped for the container?

osukaa avatar Dec 23 '15 15:12 osukaa

You can set the websocket port manually. By default it's random but in the options there's a port property. :) El El lun, 21 de mar de 2016 a las 10:43 a.m., Fábio Martins < [email protected]> escribió:

I've got the same problem. I have my application inside a container and can't make it work. The main problem comes with the websocket port, which is always changing and for that reason I can't map it in the container configurations. Maybe we could add a web socket port to the TV options? Is there any alternative with the current release of the plugin?

— You are receiving this because you were assigned. Reply to this email directly or view it on GitHub https://github.com/hapijs/tv/issues/128#issuecomment-199371702

Sent from Inbox

osukaa avatar Mar 24 '16 06:03 osukaa

I see something very similar. The error I get in chrome dev tools is: WebSocket connection to 'wss://127.0.0.1:54772/' failed: Error in connection establishment: net::ERR_CONNECTION_CLOSED

I have set the host to '127.0.0.1' in this case - I get the same thing if I set it to 'localhost' or the name of the machine.

I am running the hapi site under a self-signed SSL cert. It also doesn't work on Safari - could it be related to the self-signed cert? When I run as http everything seems to work fine.

briandela avatar May 01 '16 18:05 briandela

@malsher did you ever figure this out?

briandela avatar Jun 02 '16 22:06 briandela