Skip to main content
March 1, 2009
Question

Limiting viewers

  • March 1, 2009
  • 1 reply
  • 472 views
Is it possible to to limit the number of viewers an instance can have ?
    This topic has been closed for replies.

    1 reply

    March 1, 2009
    Yes. If you simply want to limit the number of connected clients, you can inspect the length of the application.clients array

    application.onConnect = function(client){
    if(application.clients.length >= 50){
    application.rejectConnection(client);
    }
    }

    If you want to count only specific users (i.e viewers vs. publishers) you'd need to keep track of your users individually and apply your logic in the onConnect method..
    March 2, 2009
    Thanks, how come you never answer your email ;(