Session Events

users_update

Every time a new user joins a session or an existing user leaves a session, the users_update event is emitted by the codox object.

//emitted whenever a user joins or leaves the session
codox.on("users_update", function(data){
});

The event'sdata object is an array that contains the current snapshot of users in the session. Each object in the array is a JSON object defined as follows:

Key

Value

name

string

joinTime

Date

As an example, the data object might look like:

[{
"name": "Hari",
"joinTime": Mon Sep 02 2019 16:28:47 GMT-0700 (Pacific Daylight Time) {}
},
{
"name": "Salvor",
"joinTime": Mon Sep 02 2019 16:38:47 GMT-0700 (Pacific Daylight Time) {}
}]

Subscribe to users_update to create and update user avatars within your app.