Skip to content

Commit

Permalink
Proxy friendly /events path. (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
RoboMagus authored Oct 10, 2022
1 parent 5dbaa4a commit cd46dc4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion v2/esp-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ import "./esp-logo";
import cssReset from "./css/reset";
import cssButton from "./css/button";

window.source = new EventSource("/events");
function getEventsUrl(){
url = window.location.pathname;
url += url.endsWith("/") ? "" : "/";
return url + "events";
};

window.source = new EventSource(getEventsUrl());

interface Config {
ota: boolean;
Expand Down

0 comments on commit cd46dc4

Please sign in to comment.