Skip to content

Commit

Permalink
fix incorrect websocket path
Browse files Browse the repository at this point in the history
  • Loading branch information
SchumacherFM committed Dec 23, 2024
1 parent dc8ae14 commit 2d1aa41
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,12 @@ function processMessage(data) {
function connectSocket() {
var ws, loc = window.location;
var protocol = loc.protocol === "https:" ? "wss:" : "ws:"
var path = loc.pathname.replace(/\/$/, "")
if (path === "") {
path = "/"
}

ws = new WebSocket(protocol + "//" + loc.hostname + (loc.port ? ":" + loc.port : "") + loc.pathname.replace(/\/$/, "") + "ws");
ws = new WebSocket(protocol + "//" + loc.hostname + (loc.port ? ":" + loc.port : "") + path + "ws");

ws.onerror = function(evt) {
ws.close();
Expand Down

0 comments on commit 2d1aa41

Please sign in to comment.