Skip to content

Commit

Permalink
chore(example): handle secure origins
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Feb 25, 2024
1 parent 2c63b37 commit 7f8639f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion examples/h3/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ <h3>WebSocket Test Page</h3>
<pre id="logs"></pre>

<script type="module">
const url = "ws://" + location.host + "/_ws";
const isSecure = location.protocol === "https:";
const url = (isSecure ? "wss://" : "ws://") + location.host + "/_ws";

const logsEl = document.querySelector("#logs");
let lastTime = performance.now();
Expand Down

0 comments on commit 7f8639f

Please sign in to comment.