Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8479339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:59:40+00:00 2026-06-10T18:59:40+00:00

In referrer to https://stackoverflow.com/questions/12246829/node-js-routing-data-with-socket-io On client: // send data on some event socket.emit(‘send’, {

  • 0

In referrer to https://stackoverflow.com/questions/12246829/node-js-routing-data-with-socket-io

On client:

 // send data on some event
 socket.emit('send', { u: user_id, a: action, v: value });

I have user_id and i could add user_id sender

On server:

socket.on('send', function (data) {
    socket.broadcast.emit('request', { request: data });
});

Now the data is sent to all users listening to port, but I would like to only 2 by 2 users can get data.

So, users 1 & 2 are having there “channel”, and users 3 & 4 theirs.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T18:59:42+00:00Added an answer on June 10, 2026 at 6:59 pm

    You need the id of the socket (socket.id) you want to send the request. Probably you will need an array with the user_id and its socketID (you can save it when the user enters). Then, when you know the socket id, you can send a message only to this socket.

    io.sockets.socket(socketID).emit('request', { request: data });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've referred to this very good reference: https://stackoverflow.com/questions/1282830/uiimagepickercontroller-uiimage-memory-and-more but I'm having some very serious
How do you specify a URL with path for example: http://stackoverflow.com/questions . The following
document.referrer in javascript is blank from a 302 redirect from http to https using
How can I send request to a URL: http://www.flashi.tv/embed.php?v=HitSportsNet41125 on port 80 with referrer
In my NText column, I have some data in between <script type='text/javascript'> </script> tags.
I'm trying adapt this gem, https://github.com/charlotte-ruby/impressionist to mongoid odm. I have been seeing the
I'd love to stash some .json files on a CDN a la static.mydomain.com. Truth
A way to get HTTP_REFERER , We can use document.referrer in browser side javascript
Question text/background and finds My browser sends some HTTP header (e.g. referer) to my
By using document.referrer we will get all the reference of URL in JavaScript, such

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.