This event is emitted by the server upon a change in user presence. Clients must listen for this event and update the presence status of other users in the room accordingly.
Payload Parameters
Name | Description | JSON type |
---|
category | Type of presence event received. See categories below. | string |
topicId | Unique identifier of topic to send message to. | string |
sender | Sender of the presence event- _id: unique identifier of the sender
- username: the username of the sender
- displayname: the display name of the sender
- picture_url: URL linking to the profile picture of the user
- type: what type of sender ('user', 'anonymous' or 'phone')
- phone_numbers: array of phone numbers associated with the sender
| Object |
content | Current presence state of sender.- desktop: (boolean) Not used.
- idle: (boolean) is the user inactive
- mediaSession: (object) media session state
- audio: (boolean) is the user sending audio
- connected: (boolean) is the user connected to the media session
- screenshare: (boolean) is the user sharing their screen
- selfMuted: (boolean) is the user muted
- video: (boolean) is the user sending video
- offline: (boolean) is the user disconnected
- role: (string) user's role in the space ('admin', 'member', 'guest')
- sessionId: (string) SessionId for the socket connection. For reference only.
- attendee: (object) object of an attendee in the space
- attendeeType: either 'userId' or 'anonymousId'
- attendee: ID of the attendee
| Object |
receivers | - _id: unique identifier of the receiver
- authorizedBy: NOT FOUND IN BACKEND @ MessageConstants.js:803
- authorizedResources: NOT FOUND IN BACKEND @ MessageConstants.js:803
- displayname: the display name of the receiver
- picture_url: URL linking to the profile picture of the receiver
- scope NOT FOUND IN BACKEND @ MessageConstants.js:803
- type: type of the receiver, can be either 'user' or 'anonymous'
- username: the username of the receiver
| Array of objects |
Presence Event Categories
Name | Description |
---|
app.event.presence.party.leaves | A party (sender) has left the space |
app.event.presence.party.online | A party (sender) has joined the space |
media.session.invalid | Error processing SEND_PRESENCE_EVENT |
app.event.presence.request.parties | A party is requesting the presence of all parties. Send a SEND_PRESENCE_EVENT with category 'app.event.presence.party.online'. |
party.removed | A party (sender) has ben removed from space |
Authorization
Subscribed to channel.
Example
socketConnection.on('PRESENCE_EVENT_RESPONSE', callback(payload));
Payload ('app.event.presence.party.online')
{
"category": "app.event.presence.party.online",
"content": {
"desktop": false,
"idle": false,
"mediaSession": {
"audio": false,
"connected": false,
"phone": false,
"screenshare": false,
"selfMuted": false,
"video": false
},
"offline": false,
"role": "member",
"sessionId": "fce9bced-8994-4c70-f171-c3c0c1640b77",
"subscribeTime": "2020-08-04T13:11:48.376Z"
},
"receivers": [
{
"_id": "5f04251caa4a347af9946f06",
"authorizedBy": null,
"authorizedResources": null,
"displayname": "Test User",
"picture_url": "https://storage.googleapis.com/onesna/pictures/pfpic_test_34cb97bd-0151-449d-84b0-48e07853b49f",
"scope": null,
"type": "user",
"username": "test@user.com"
}
],
"sender": {
"_id": "5f04251caa4a347af9945f06",
"displayname": "Igor Test",
"phone_numbers": [
],
"picture_url": "https://storage.googleapis.com/onesna/pictures/pfpic_test_509a2f79-a004-4d27-b819-9934af9582d1",
"type": "user",
"username": "test@user.com"
},
"topicId": "5eecfda30da7fa05033f15ef"
}
Payload ('app.event.presence.party.leaves')
{
"topicId":"5f06c25e574ca36b54cb4cdf",
"sender":{
"_id":"5f0426ccaa4a34aaf9994cdf",
"type":"user",
"username":"test@user.com",
"displayname":"Test User 2",
"picture_url":"https://storage.googleapis.com/onesna/pictures/pfpic_vtest_3da9345d-6038-4667-9f3d-f79a47b1d05c",
"phone_numbers":[
]
},
"content":{
"offline":false,
"idle":false,
"mediaSession":{
"audio":false,
"video":false,
"connected":false,
"phone":false,
"selfMuted":false,
"screenshare":false
},
"desktop":false,
"role":"member",
"sessionId":"9b18ed68-1009-4441-e01c-9c577db2897f"
},
"category":"app.event.presence.party.leaves",
"receivers":[
]
}
Payload ('party.removed')
{
"category":"party.removed",
"topicId":"5f06c25e574ca36b54cb4cdf",
"sender":{
"type":"user",
"_id":"5f04251caa4a347af9946f06",
"displayname":"Test User"
},
"content":{
"attendee":{
"attendeeType":"userId",
"attendee":"5f0426ccaa4a34aaf9994cdf"
}
}
}
Payload ('app.event.presence.request.parties')
{
"category":"app.event.presence.request.parties",
"content":{
"sessionId":"9b18ed68-1009-4441-e01c-9c577db2897f",
"data":[
]
},
"sender":{
"_id":"5f0426ccaa4a34aaf9994cdf",
"username":"test@user.com",
"displayname":"Test User 2",
"picture_url":"https://storage.googleapis.com/onesna/pictures/pfpic_vtest_3da9345d-6038-4667-9f3d-f79a47b1d05c",
"type":"user",
"authorizedBy":null,
"authorizedResources":null,
"scope":null
},
"topicId":"5f06c25e574ca36b54cb4cdf"
}
Payload ('media.session.invalid') INFERED FROM BACKEND, COULD BE WRONG
{
"topicId":"5f06c25e574ca36b54cb4cdf",
"sender":{
"type":"user",
"_id":"5f04251caa4a347af9946f06",
"displayname":"Test User"
},
"category":"media.session.invalid",
"loopbackMetadata":"some metadata"
}
Payload for dialin user ('app.event.presence.party.online') COULD NOT TEST IT
{
"_id": "00fa52ac-1904-46ea-b7dc-1c496a712aef",
"category": "app.event.presence.party.online",
"content": {
"offline": false,
"role": "guest",
"mediaSession": {
"video": false,
"audio": true,
"connected": true,
"screenshare": false,
"selfMuted": false,
"phone": true
},
"idle": false,
"desktop": false,
"emitedby": "wcs",
"sessionId": "CAe1889084a107d447398c45f7ab8f7aa2"
},
"sender": {
"displayname": "John Smith",
"_id": "CAe1889084a107d447398c45f7ab8f7aa2",
"type": "phone",
"username": "jsmith@fakeemail.com",
"picture_url": "https://storage.googleapis.com/onesnatesting/pictures/pfpic_johns_026498e4-e761-4acf-9a09-5b37ac7ed072"
},
"topicId": "5a1339868509b80641a56655"
}
Payload for dialin user ('app.event.presence.party.leaves') COULD NOT TEST IT
{
"_id": "a5121c6d-33c4-4da7-841f-17a0225db85f",
"category": "app.event.presence.party.leaves",
"content": {
"offline": false,
"role": "guest",
"mediaSession": {
"video": false,
"audio": true,
"connected": false,
"screenshare": false,
"selfMuted": false,
"phone": false
},
"idle": false,
"desktop": false,
"emitedby": "wcs",
"sessionId": "CAe1889084a107d447398c45f7ab8f7aa2"
},
"sender": {
"displayname": "John Smith",
"_id": "CAe1889084a107d447398c45f7ab8f7aa2",
"type": "phone",
"username": "jsmith@fakeemail.com",
"picture_url": "https://storage.googleapis.com/onesnatesting/pictures/pfpic_johns_026498e4-e761-4acf-9a09-5b37ac7ed072"
},
"topicId": "5a1339868509b80641a56655"
}