Debug failing socket connection
This commit is contained in:
parent
a67fecd94d
commit
fecba64158
|
@ -2,6 +2,7 @@ import http from "http";
|
|||
import https from "https";
|
||||
import path from "path";
|
||||
|
||||
import cors from "cors"
|
||||
import express from "express";
|
||||
import ws from "express-ws";
|
||||
import _ from "lodash";
|
||||
|
@ -20,6 +21,9 @@ const fathomSiteId = process.env.FATHOM_SITE_ID || "";
|
|||
const langs = await langsPromise;
|
||||
const app = express();
|
||||
|
||||
app.use(cors());
|
||||
app.options("*", cors());
|
||||
|
||||
app.set("query parser", (qs) => new URLSearchParams(qs));
|
||||
app.set("view engine", "ejs");
|
||||
|
||||
|
|
|
@ -137,7 +137,6 @@ async function main() {
|
|||
window.addEventListener("message", (msg) => {
|
||||
console.log(msg)
|
||||
})
|
||||
console.log('change made')
|
||||
|
||||
await new Promise((resolve) =>
|
||||
term.write("Connecting to server...", resolve)
|
||||
|
@ -167,6 +166,9 @@ async function main() {
|
|||
document.location.host +
|
||||
`/api/v1/ws?lang=${encodeURIComponent(config.id)}`
|
||||
);
|
||||
socket.addEventListener("error", (ev) => {
|
||||
console.log(ev)
|
||||
})
|
||||
socket.addEventListener("open", () => {
|
||||
connectionStatus.innerText = "connected";
|
||||
console.log("Successfully connected to server");
|
||||
|
|
Loading…
Reference in New Issue