Classes
- Application
- Conversation
- ConversationsPage
- EventsPage
- ImageEvent
- Media
- Member
- MembersPage
- MessageEvent
- NexmoApiError
- NexmoClient
- NexmoClientError
- NXMCall
- NXMEvent
- TextEvent
- UserSessionsPage
Events
-
call:status:changed
-
Application listening for nxmCall status changed events.
- Source:
Properties:
Name Type Description nxmCall
NXMCall the actual event
Example
application.on("call:status:changed",(nxmCall) => { console.log("call: " + nxmCall.status); });
-
NXM-errors
-
Application listening for client and expired-token errors events.
- Source:
Properties:
Name Type Description error
NexmoClientError Examples
application.on('*', 'NXM-errors', (error) => { console.log('Error thrown with type ' + error.type); });
application.on('system:error:expired-token', 'NXM-errors', (error) => { console.log('token expired'); application.updateToken(token); });
-
member:call
-
Application listening for member call events.
- Source:
Properties:
Name Type Description member
Member the member that initiated the nxmCall
nxmCall
NXMCall resolves the nxmCall object
Example
application.on("member:call", (member, nxmCall) => { console.log("NXMCall ", nxmCall); });
-
member:invited
-
Application listening for member invited events.
- Source:
Properties:
Example
application.on("member:invited",(member, event) => { console.log("Invited to the conversation: " + event.conversation.display_name || event.conversation.name); // identify the sender. console.log("Invited by: " + member.invited_by); //accept an invitation. application.conversations.get(event.conversation.id).join(); //decline the invitation. application.conversations.get(event.conversation.id).leave(); });
-
member:joined
-
Application listening for member joined events.
- Source:
Properties:
Name Type Description member
Member the member that joined the conversation
event
NXMEvent the join event
Example
application.on("member:joined",(member, event) => { console.log("JOINED", "Joined conversation: " + event.conversation.display_name || event.conversation.name); });
-
sync:progress
-
Application listening for sync status events.
- Source:
Properties:
Name Type Description status.sync_progress
number Percentage of fetched conversations
Example
application.on("sync:progress",(status) => { console.log(status.sync_progress); });
-
audio:mute:off
-
Conversation listening for mute off events
A member has unmuted their audio- Source:
Properties:
Name Type Description member
Member the member object linked to this event
event
NXMEvent information about the mute event
Example
conversation.on("audio:mute:off", (member, event) => { console.log("member that is unmuted ", member); console.log(event); });
-
audio:mute:on
-
Conversation listening for mute on events
A Member has muted their audio- Source:
Properties:
Name Type Description member
Member the Member object linked to this event
event
NXMEvent information about the mute event
Example
conversation.on("audio:mute:on", (member, event) => { console.log("member that is muted ", member); console.log(event); });
-
event:delete
-
Conversation listening for deleted events.
- Source:
Properties:
Name Type Description member
Member the Member who deleted an event
event
NXMEvent deleted event: event.id
Example
conversation.on("event:delete", (member, event) => { console.log(event.id); console.log(event.body.timestamp.deleted); });
-
image
-
Conversation listening for image events.
- Source:
Properties:
Name Type Description sender
Member The sender of the image
image
ImageEvent The image message received
Example
conversation.on("image", (sender, image) => { console.log(sender,image); // Identify if your own imageEvent or someone else's. if (image.from !== conversation.me.id){ displayImages(image); } });
-
text
-
Conversation listening for text events.
- Source:
Properties:
Example
conversation.on("text",(sender, message) => { console.log(sender, message); // Identify your own message. if (message.from === conversation.me.id){ renderMyMessages(message) } else { renderOtherMessages(message) } });
-
image:seen
-
Conversation listening for Members' seen images.
- Source:
Properties:
Name Type Description member
Member the member that saw the image
image
ImageEvent the image that was seen
Example
conversation.on("image:seen", (member, image) => { console.log(image); if (conversation.me.id !== member.memberId) { console.log(member); }; });
-
member:call:status
-
Conversation listening for Members callStatus changes.
Example
conversation.on("member:call:status", (member) => { console.log(member.callStatus); });
-
member:invited
-
Conversation listening for Members being invited.
- Source:
Properties:
Name Type Description member
Member the Member that is invited
event
NXMEvent data regarding the receiver of the invitation
Example
conversation.on("member:invited", (member, event) => { console.log(member.userName + " invited to the conversation"); });
-
member:joined
-
Conversation listening for new Members.
- Source:
Properties:
Example
conversation.on("member:joined", (member, event) => { console.log(event.id) console.log(member.userName+ " joined the conversation"); });
-
member:left
-
Conversation listening for Members leaving (kicked or left).
- Source:
Properties:
Name Type Description member
Member the Member that has left
event
NXMEvent data regarding the receiver of the invitation
Example
conversation.on("member:left", (member , event) => { console.log(member.userName + " left"); console.log(event.body.reason); });
-
member:media
-
Conversation listening for Members media changes (audio,text)
Change in media presence state. They are in the Conversation with text or audio.
- Source:
Properties:
Name Type Description member
Member the Member object linked to this event
event
NXMEvent information about media presence state
Properties
Name Type Description body.audio
boolean is audio enabled
Example
conversation.on("member:media", (member, event) => { console.log(event.body.media); //{"audio": true, "audio_settings": {"enabled": true, "muted": false, "earmuffed": false}} });
-
message:delivered
-
Conversation listening for Members delivered messages.
- Source:
Properties:
Name Type Description member
Member the member that message was delivered to
message
MessageEvent the message that was delivered
Example
conversation.on("message:delivered", (member, message) => { console.log(message); if (conversation.me.id !== member.memberId) { console.log(member); }; });
-
message:rejected
-
Conversation listening for Members rejected messages.
- Source:
Properties:
Name Type Description member
Member the member that message was rejected by
message
MessageEvent the message that was rejected
Example
conversation.on("message:rejected", (member, message) => { console.log(message); if (conversation.me.id !== member.memberId) { console.log(member); }; });
-
message:seen
-
Conversation listening for Members seen messages.
- Source:
Properties:
Name Type Description member
Member the member that message was seen by
message
MessageEvent the message that was seen
Example
conversation.on("message:seen", (member, message) => { console.log(message); if (conversation.me.id !== member.memberId) { console.log(member); }; });
-
message:submitted
-
Conversation listening for Members submitted messages.
- Source:
Properties:
Name Type Description member
Member the member that message was submitted to
message
MessageEvent the message that was submitted
Example
conversation.on("message:submitted", (member, message) => { console.log(message); if (conversation.me.id !== member.memberId) { console.log(member); }; });
-
message:undeliverable
-
Conversation listening for Members undeliverable messages.
- Source:
Properties:
Name Type Description member
Member the member that message was undeliverable to
message
MessageEvent the message that was undeliverable
Example
conversation.on("message:undeliverable", (member, message) => { console.log(message); if (conversation.me.id !== member.memberId) { console.log(member); }; });
-
text:seen
-
Conversation listening for Members' seen texts.
- Source:
Properties:
Name Type Description member
Member the Member that saw the text
text
TextEvent the text that was seen
Example
conversation.on("text:seen", (member, text) => { console.log(text); if (conversation.me.id !== member.memberId) { console.log(member); } });
-
text:typing:off
-
Conversation listening for Members stopped typing.
- Source:
Properties:
Name Type Description member
Member the member that stopped typing
event
NXMEvent the stop typing event
Example
conversation.on("text:typing:off", (member, event) => { console.log(member.displayName + " stopped typing..."); });
-
text:typing:on
-
Conversation listening for Members typing.
- Source:
Properties:
Name Type Description member
Member the member that started typing
event
NXMEvent the start typing event
Example
conversation.on("text:typing:on", (member, event) => { console.log(member.displayName + " is typing..."); });
-
media:stream:on
-
Member listening for audio stream on.
- Source:
Properties:
Name Type Argument Description payload.streamIndex
number the index number of this stream
payload.rtc_id
number <optional>
the rtc_id / leg_id
payload.remote_member_id
string <optional>
the id of the Member the stream belongs to
payload.name
string <optional>
the stream's display name
payload.stream
MediaStream the stream that is activated
payload.audio_mute
boolean <optional>
if the audio is muted
-
disconnect
-
Client listening for disconnect event.
Example
rtc.on("disconnect", (reason) => { console.log("disconnect", reason); });
-
error
-
Client listening for error event.
Example
rtc.on("error", (error) => { console.log("error", error); });
-
ready
-
Client listening for ready event.
Example
rtc.on("ready", () => { console.log("connection ready"); });
-
reconnect
-
Client listening for reconnect event.
Example
rtc.on("reconnect", (retry_number) => { console.log("reconnect", retry_number); });
-
reconnecting
-
Client listening for reconnecting event.
Example
rtc.on("reconnecting", (retry_number): void => { console.log("reconnecting", retry_number); });