statianzo / webpack-livereload-plugin

LiveReload during webpack --watch
ISC License
203 stars 51 forks source link

Configure polling on client in place of wss:// calls? #58

Closed laurencefass closed 4 years ago

laurencefass commented 4 years ago

Im testing a basic chat server attempting to make it reload on save using this plugin. I can load the page and the assets and the chat socket is working ok but livereload is not working and Im getting an error on page load.

live test server here: https://socket.syntapse.co.uk/chat3.

chrome devtools shows the websocket error:

error: WebSocket connection to 'wss://socket.syntapse.co.uk:80/chat3/livereload' failed: Error in connection establishment: net::ERR_SSL_PROTOCOL_ERROR. My simple chat server using polling a socket which seems to work fine through my reverse proxy which is all i really need for demo purposes. Is there way to use polling for live reload as a workaround?

If not possible can anyone offer any pointers on correct configuration of nginx for this scenario?

thanks

statianzo commented 4 years ago

wss expects an SSL connection, but you're pointed at port 80. If I recall, you were using an nginx proxy. Is it already serving SSL for socket.synapse.co.uk https traffic? If so, you just need to have it use the same settings for the /livereload proxy configuration.

laurencefass commented 4 years ago

I'm running an application rproxy behind a docker-rproxy with LetsEncrypt enabled which is doing all the necessary encryption automatically. The backend is entirely http for routes and sockets. All my other sockets are polling https so seem to work ok. I realise this is out of scope hence I'm trying to force polling because i know it works and I just want to demo it and worry about wss:// later.

thanks

statianzo commented 4 years ago

I believe that tiny-lr/livereload.js only supports websockets with no fallback given it's designed for development use.

https://github.com/livereload/livereload-js/blob/master/src/livereload.js#L30

laurencefass commented 4 years ago

thanks for advice i need to take long hard look at my proxy config.