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 6361467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:46:53+00:00 2026-05-24T23:46:53+00:00

Im using the opentok and socket.io packages to try and create 2 groups. I

  • 0

Im using the opentok and socket.io packages to try and create 2 “groups”. I have been able to pair up non grouped users with a 1to1 relationship just fine. What Im trying to do is have 2 groups of users. Lets say one group is a help desk and the other group is a customer. I want all the customers to be grouped together but not connect to one another. I would also like for the same behavior with the help desk group. I then want any 1to1 pair to group together ie. helpdeskTOcustomer. I would provide some code, but from a logical standpoint im not even sure how to begin coding this and the only thing I would be able to provide is just the slightly modified code from here.. http://www.tokbox.com/developersblog/code-snippets/opentok-sessions-using-node-js/

  • 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-05-24T23:46:54+00:00Added an answer on May 24, 2026 at 11:46 pm

    It’s not really clear from your question exactly what you’re trying to do (e.g. what do you mean by “pair” or “group together”), but you may find some use of Socket.IO’s rooms.

    Sometimes you want to put a bunch of sockets in one room, and send a message to them [all at once]. You can leverage rooms by calling join on a socket, and then [send data or emit events] with the flags to and in:

    io.sockets.on('connection', function (socket) {
      socket.join('a room');
      socket.broadcast.to('a room').send('im here');
      io.sockets.in('some other room').emit('hi');
    });
    

    [Edit]

    Okay, after seeing your comment and looking over the OpenTok docs a bit (I wasn’t familiar with it, it seems pretty neat), it looks like you just want a queue for each type of user, right? Here’s a bit of code (more like pseudocode, as I’m not intimately familiar with your app or the OpenTok API):

    var customers_waiting = [];
    var employees_waiting = [];
    
    io.sockets.on("connection", function(socket) {
      // Determining whether a connecting socket is a customer
      // or an employee will be a function of your specific application.
      // Determining this in this callback may not work depending on your needs!
      if(/* client is a customer*/) {
        customers_waiting.push(socket); // put the customer in the queue
      else if(/* client is an employee */) {
        employees_waiting.push(socket); // put the employee in the queue
      }
    
      try_to_make_pair();
    });
    
    function try_to_make_pair() {
      if(customers_waiting.length > 0 && employees_waiting.length > 0) {
        // If we have people in both queues, remove the customer and employee
        // from the front of the queues and put them in a session together.
        customer = customers_waiting.shift();
        employee = employees_waiting.shift();
    
        opentok.createSession('localhost', {}, function(session) {
          enterSession(session, customer);
          enterSession(session, employee);
        }
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using OpenTK in C# and I have been hitting a wall for
Using online interfaces to a version control system is a nice way to have
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
I am using WPF and OpenTk and I have a GLControl that is set
Using SolrNet for querying & faceting. I have a combination of int, tdate and
quick question about Heroku. My app is using a gem called opentok. To function
I have developed a quite large application using MFC. Naturaly, I used GDI for
Using report builder 3.0, I have a report that queries a cube. How do
Using Rails 3.2.0.rc2 and ruby 1.9.3p0 In app/views/requests/_form.html.erb I have the following code for
Using Entity Framework CodeFirst, how do I create a created datetime column that gets

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.