Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

252
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!