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

255
Vistas
socket.io - How to check if the client has connected from browser

What is the most reliable way to detect if some one has directly connect to my socket connection instead of browser? I know that we can bypass all of that but I realized some WebSockets like tradingView return 403 when connecting directly from socket.io-client but works fine from browser.

How does it detect that And How can I implement that for my own socket.io server?

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

0

I'm not sure how to get device/browser/app the client is connected with but I managed to do something like that using handshake query of socket.io. I needed to distinguish between admin and client so in my client side I used this code:

 const socket = io({
        query: {
            isAdmin: true,
            name: "GetSub Admin"
        },
        // path: '/websockets',
        resource: '/websockets'
    });

and on the server side I used

if (client.handshake.query.isAdmin == 'true') {
            admins.push({
                id: client.id,
                name: client.handshake.query.name
            });
        }
        else {
            users.push({
                id: client.id,
                name: client.handshake.query.name
            });

maybe this will help you.

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