Open apla opened 5 years ago
I'm not very up-to-date with this. This would function as a replacement for websockets, right? If so, how would you want to signal you want to use SSE instead? Or would livereload 'listen' to both at the same time?
Unfortunately, this not works with minified version nor version 3.0.1.
You mean this doesn't work with something that happened with 3.x (as in: it did work with 2.x)? Or what is problematic with version 3.0.1 and/or minification?
I would like to make it works without LiveReload.connector.disconnect() if that's fine for you
You mean you currently need the first 3 lines to stop the websocket? In that case, it is connected to my first question I guess?
I'm not very up-to-date with this. This would function as a replacement for websockets, right?
If so, how would you want to signal you want to use SSE instead? Or would livereload 'listen' to both at the same time?
Actually, I'm preparing the pull request for this. As a LiveReload user, you can choose between WebSockets and EventSource (SSE). WebSockets will be default choice.
From my point of view WebSocket is just a transport to send reload
and alert
commands. SSE will be additional transport to send those events. I'm planning to add transport
property to the Options
object and in case transport = sse, different connector will start and emit reload
or alert
events. Options
already contains host
, port
and path
, so transport
will be enough.
You mean this doesn't work with something that happened with 3.x (as in: it did work with 2.x)? Or what is problematic with version 3.0.1 and/or minification?
Not sure about problem in minified version, but I've fixed issue with 3.0.1 in #88
You mean you currently need the first 3 lines to stop the websocket? In that case, it is connected to my first question I guess?
With my patch, disconnect()
will not be needed anymore, so no problem with minified version.
I'm not fully comprehending what the issues with the minified version are, but if you can/could solve them: awesome.
The idea of multiple transports sounds nice! Looking forward to your PR! Thanks!
For our project we would like to use SSE. Currently, code to activate SSE for LiveReload 3.0.0 is quite simple:
Unfortunately, this not works with minified version nor version 3.0.1. I would like to make it works without
LiveReload.connector.disconnect()
if that's fine for you