How do I get the number of connections in the session?
Obtaining the number of connections in a session.
- Video API
- Session Connections
The session object dispatches a connectionCreated event for each client connected to the session. To count the number of connections in the session:
- Create a variable called numberOfConnections and initialize it to zero.
- Listen to the "connectionCreated" event and increment the variable numberOfConnections inside the event handler. The value of this variable then gives you the number of clients connected to the session at any instant of time.
Please sign in to leave a comment.