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

346
Vistas
Websocket uses more network bandwidth than http

I am doing a project and I got stuck with websockets. I am using express.ws library. Lately, the app has worked without websockets at all: all the requests were sent from the client in a plain http request. However, my app is built so that the clients have to ask the server for data rather often, so websocket looks like a correct solution for me. I have rewritten all my http endpoints to a ws which establishes only ones. However, it does not look like it has become more optimized: the network usage used to be about 35 Mb/s (incoming) before, but now it grows up to 90 Mb/s which is weird as websockets should not transfer a lot of "rubbish" data like headers with every message. Is it an expected behavior or am I misusing ws somewhere?

//if it may be important, I am using helmet, cors, hpp and express-device to build the middleware security. However, commenting those lines does not change anything
const httpsServer = https.createServer({...}, global.app);
express_ws(app, httpsServer);
app.ws('/extension', (ws, req) =>
{
    //setting some details from req.query to ws.data
    ws.on('message', async (msg) =>
    {
        msg = JSON.parse(msg);
        if (msg.type == '...') { //handling the request and sending the response }
        //some more similar handlers
    });
});
over 4 years ago · Santiago Trujillo
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