Change source (url) of Server-Sent event
问题 How can I change the source set in declaration of EventSource ? I have tried something like this: var source = new EventSource("/blahblah.php?path=" + (window.location.pathname)); // Few lines later... source.url = "/blahblah.php?path=" + url; But, source.url stays the same... Is this even possible? Or maybe there are alternative ways to do that? 回答1: No, it is not possible. A new URL passed to EventSource() creates a new EventSource object. 回答2: guest271314 suggested me much solutions to