Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

287
Vistas
can't connect to websocket (Mixed Content)

so i was trying to make web socket server

node js

const WebSocket = require("ws");
var porth = process.env.PORT || 80;
const wss = new WebSocket.Server({port:porth})

wss.on("connection", ws => {
    console.log("nowe połączenie");
    ws.on("message",  data => {
        console.log(data.toString());
    });
    ws.send("hej");
    ws.on("close", () =>
    {
        console.log("rozłączenie");
    });
})

app.js

ws.addEventListener("open", () => {
  console.log("połączono")
  ws.send("test");
  ws.addEventListener("message", data => {
    console.log(data.data)
  })
})

and when i host it on my pc it works but when i upload it to github pages it keeps sending me error:

Mixed Content: The page at 'https://*****.github.io/' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://****.herokuapp.com/'. This request has been blocked; this endpoint must be available over WSS.

and i dont know what should i do about it

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

So from this error I assume that you are connecting between secure and not secure site. I'm not sure but if I can I would suggest you to see ws https server. Maybe this will help https://github.com/websockets/ws#external-https-server

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda