Skip to content

Events 1.66.1

vberder01 edited this page Jan 31, 2020 · 1 revision

Events

Kind: global class
Emits: rainbow_onmessageserverreceiptreceived, rainbow_onmessagereceiptreceived, rainbow_onmessagereceiptreadreceived, rainbow_onmessagereceived, rainbow_onsendmessagefailed, rainbow_oncontactpresencechanged, rainbow_onpresencechanged, rainbow_onconversationremoved, rainbow_onconversationchanged, rainbow_onallmessagedremovedfromconversationreceived, rainbow_onchatstate, rainbow_oncontactinformationchanged, rainbow_onuserinvitereceived, rainbow_onuserinviteaccepted, rainbow_onuserinvitecanceled, rainbow_onbubbleaffiliationchanged, rainbow_onbubbleownaffiliationchanged, rainbow_onbubbleinvitationreceived, Events#event:rainbow_onbubblecustomDatachanged, rainbow_onbubbletopicchanged, rainbow_onbubbleprivilegechanged, rainbow_onbubbleavatarchanged, rainbow_onbubblenamechanged, rainbow_ongroupcreated, rainbow_ongroupdeleted, rainbow_ongroupupdated, rainbow_onuseraddedingroup, rainbow_onuserremovedfromgroup, rainbow_onstarted, rainbow_onstopped, rainbow_onready, rainbow_onerror, rainbow_onconnected, rainbow_onconnectionerror, rainbow_ondisconnected, rainbow_onreconnecting, rainbow_onfailed, rainbow_oncallupdated, rainbow_onconferenced, rainbow_ontelephonystatuschanged, rainbow_onnomadicstatusevent, rainbow_onvoicemessageupdated, rainbow_oncallforwarded, rainbow_onchannelmessagereceived, rainbow_onchannelmessagedeletedreceived, rainbow_onprofilefeatureupdated, rainbow_onfilecreated, rainbow_onfileupdated, rainbow_onfiledeleted, rainbow_onthumbnailcreated, rainbow_onchannelupdated, rainbow_onchannelusersubscription, rainbow_onmediapropose, rainbow_oncalllogupdated, rainbow_oncalllogackupdated, rainbow_onfavoritecreated, rainbow_onfavoritedeleted

new Events()

This module fires every events that come from Rainbow.
To receive them, you need to subscribe individually to each of the following events

events.on(event, callback) ⇒ Object

Subscribe to an event

Kind: instance method of Events
Returns: Object - The events instance to be able to chain subscriptions
Access: public

Param Type Description
event string The event name to subscribe
callback function The function called when the even is fired

events.once(event, callback) ⇒ Object

Subscribe to an event only one time (fired only the first time)

Kind: instance method of Events
Returns: Object - The events instance to be able to chain subscriptions
Access: public

Param Type Description
event string The event name to subscribe
callback function The function called when the even is fired

"rainbow_onmessageserverreceiptreceived" (receipt)

Fired when the message has been received by the server

Kind: event emitted by Events
Access: public

Param Type Description
receipt Object The receipt received by the server
receipt.event string The type of receipt. Can be read or received. Should be received in that case
receipt.entity string The entity who sent the receipt. Can be server or client. Should be server in that case
receipt.type string The type of the message. Can be chat or groupchat.
receipt.id string The id of the message sent (linked to that receipt)

"rainbow_onmessagereceiptreceived" (receipt)

Fired when the message has been received by the recipient

Kind: event emitted by Events
Access: public

Param Type Description
receipt Object The receipt received by the server
receipt.event string The type of receipt. Can be read or received. Should be received in that case
receipt.entity string The entity who sent the receipt. Can be server or client. Should be client in that case
receipt.type string The type of the message. Can be chat or groupchat
receipt.id string The id of the message sent (linked to that receipt)
receipt.fromJid string The Bare JID of the recipient who sent this receipt,
receipt.resource string The resource JID of the recipient who sent this receipt

"rainbow_onmessagereceiptreadreceived" (receipt)

Fired when the message has been read by the recipient

Kind: event emitted by Events
Access: public

Param Type Description
receipt Object The receipt received by the server
receipt.event string The type of receipt. Can be read or received. Should be read in that case
receipt.entity string The entity who sent the receipt. Can be server or client. Should be client in that case
receipt.type string The type of the message. Can be chat or groupchat
receipt.id string The id of the message sent (linked to that receipt)
receipt.fromJid string The Bare JID of the recipient who sent this receipt,
receipt.resource string The resource JID of the recipient who sent this receipt

"rainbow_onmessagereceived" (message)

Fired when a chat message is received (in a one-to-one conversation or in a Bubble conversation)

Kind: event emitted by Events
Access: public

Param Type Description
message Message The message received

"rainbow_onsendmessagefailed" (message)

Fired when a chat message with no-store attribut sent has failed.

Kind: event emitted by Events
Access: public

Param Type Description
message Message The message which failed to be sent.

"rainbow_oncontactpresencechanged" (contact)

Fired when the presence of a contact changes

Kind: event emitted by Events
Access: public

Param Type Description
contact Contact The contact

"rainbow_onpresencechanged" (presence)

This event is fired when the presence of the connected user changes
status may be
+ "unknow",
+ "online" (with message "" | "mode=auto"),
+ "away" (with message "" ),
+ "xa" (with message ""| "away"),
+ "dnd" (with message "" | "audio" | "video" | "sharing" | "presentation")
This event is also a confirmation from the server that the new presence value has been set

Kind: event emitted by Events
Access: public

Param Type Description
presence Object The presence object updated (jid, status, message, stamp)

"rainbow_onconversationremoved" (conversation)

This event is fired when a conversation has been removed

Kind: event emitted by Events
Access: public

Param Type Description
conversation Object The conversation object
conversation.conversationId String Conversation identifier

"rainbow_onconversationchanged" (conversation)

This event is fired when a conversation has changed

Kind: event emitted by Events
Access: public

Param Type Description
conversation Conversation The conversation

"rainbow_onallmessagedremovedfromconversationreceived" (conversation)

This event is fired when a conversation has changed

Kind: event emitted by Events
Access: public

Param Type Description
conversation Conversation The conversation where the messages as all been removed.

"rainbow_onchatstate" (chatstate)

This event is fired when a chatstate event occurs

Kind: event emitted by Events
Access: public

Param Type Description
chatstate Object The chatstate

"rainbow_oncontactinformationchanged" (contact)

This event is fired when a conversation has been removed

Kind: event emitted by Events
Access: public

Param Type Description
contact Contact The contact

"rainbow_onuserinvitereceived" (invitation)

Fired when an user invitation is received

Kind: event emitted by Events
Access: public

Param Type Description
invitation Invitation The invitation received

"rainbow_onuserinviteaccepted" (invitation)

Fired when an user invitation is accepted

Kind: event emitted by Events
Access: public

Param Type Description
invitation Invitation The invitation accepted

"rainbow_onuserinvitecanceled" (invitation)

Fired when an user invitation is canceled

Kind: event emitted by Events
Access: public

Param Type Description
invitation Invitation The invitation canceled

"rainbow_onbubbleaffiliationchanged" (bubble)

Fired when a user changes his affiliation with a bubble

Kind: event emitted by Events
Access: public

Param Type Description
bubble Bubble The bubble updated

"rainbow_onbubblepresencechanged" (bubble)

Fired when a presence changes is a user connected bubble

Kind: event emitted by Events
Access: public

Param Type Description
bubble Bubble The bubble updated

"rainbow_onbubbleownaffiliationchanged" (bubble)

Fired when a user changes the user connected affiliation with a bubble

Kind: event emitted by Events
Access: public

Param Type Description
bubble Bubble The bubble updated

"rainbow_onbubbledeleted" (bubble)

Fired when a user deletes a bubble the user is affiliated to

Kind: event emitted by Events
Access: public

Param Type Description
bubble Bubble The bubble deleted

"rainbow_onbubbleinvitationreceived" (bubble)

Fired when an invitation to join a bubble is received

Kind: event emitted by Events
Access: public

Param Type Description
bubble Bubble The invitation bubble

"rainbow_onbubblecustomdatachanged" (bubble)

Fired when the custom data of a bubble has changed

Kind: event emitted by Events
Access: public

Param Type Description
bubble Bubble The bubble updated with the new custom data set

"rainbow_onbubbletopicchanged" (bubble)

Fired when the topic of a bubble has changed

Kind: event emitted by Events
Access: public

Param Type Description
bubble Bubble The bubble updated with the new topic set

"rainbow_onbubbleprivilegechanged" (bubble)

Fired when the privilage of a bubble has changed

Kind: event emitted by Events
Access: public

Param Type Description
bubble Object The bubble updated with the new privilege set privilege The privilege updated (Can be moderator, user, owner)

"rainbow_onbubbleavatarchanged" (bubble)

Fired when the avatar of a bubble has changed

Kind: event emitted by Events
Access: public

Param Type Description
bubble Bubble The bubble updated with a new avatar

"rainbow_onbubblenamechanged" (bubble)

Fired when the name of a bubble has changed

Kind: event emitted by Events
Access: public

Param Type Description
bubble Bubble The bubble updated with the new name set

"rainbow_ongroupcreated" (group)

Fired when a group is created

Kind: event emitted by Events
Access: public

Param Type Description
group Group The created group

"rainbow_ongroupdeleted" (group)

Fired when a group is deleted

Kind: event emitted by Events
Access: public

Param Type Description
group Group The deleted group

"rainbow_ongroupupdated" (group)

Fired when a group is updated

Kind: event emitted by Events
Access: public

Param Type Description
group Group The updated group

"rainbow_onuseraddedingroup" (group, contact)

Fired when a user is added in a group

Kind: event emitted by Events
Access: public

Param Type Description
group Group The group where the user is added
contact Contact The user added

"rainbow_onuserremovedfromgroup" (group, contact)

Fired when a user is removed from a group

Kind: event emitted by Events
Access: public

Param Type Description
group Group The group where the user is removed
contact Contact The user removed

"rainbow_onchannelmessagereceived" (message)

Fired when a message is received from a channel

Kind: event emitted by Events
Access: public

Param Type Description
message ChannelMessage The message received

"rainbow_onchannelmessagedeletedreceived" (message)

Fired when a message is received from a channel

Kind: event emitted by Events
Access: public

Param Type Description
message messageId The id of the deleted message received

"rainbow_onprofilefeatureupdated"

Fired when a profile feature updated event is received

Kind: event emitted by Events
Access: public

 |

"rainbow_oncallupdated"

Fired when a call event is received

Kind: event emitted by Events
Access: public

Type |
--- |
data |

"rainbow_onconferenced"

Fired when a conference event is received

Kind: event emitted by Events
Access: public

Type |
--- |
data |

"rainbow_ontelephonystatuschanged"

Fired when status of the telephony service event is received

Kind: event emitted by Events
Access: public

Type |
--- |
data |

"rainbow_onnomadicstatusevent"

Fired for nomadic of the telephony event

Kind: event emitted by Events
Access: public

Type |
--- |
data |

"rainbow_onvoicemessageupdated"

Fired when a voice message updated event is received

Kind: event emitted by Events
Access: public

Type |
--- |
data |

"rainbow_oncallforwarded"

Fired when a call forwarded event is received

Kind: event emitted by Events
Access: public

Type |
--- |
data |

"rainbow_onfilecreated"

Fired when a file created event is received

Kind: event emitted by Events
Access: public

Type |
--- |
data |

"rainbow_onfileupdated"

Fired when a file updated event is received

Kind: event emitted by Events
Access: public

Type |
--- |
data |

"rainbow_onfiledeleted"

Fired when a file deleted event is received

Kind: event emitted by Events
Access: public

Type |
--- |
data |

"rainbow_onthumbnailcreated"

Fired when a thumbnail created event is received

Kind: event emitted by Events
Access: public

Type |
--- |
data |

"rainbow_onchannelupdated" (id, kind)

Fired when a channel update event is received

Kind: event emitted by Events
Access: public

Param Type Description
id String The id of the channel
kind Number The kind of change (ADD: 0, UPDATE: 1, REMOVE: 2, SUBSCRIBE: 4, UNSUBSCRIBE: 5)

"rainbow_onchannelusersubscription" (id, userId, kind)

Fired when a user channel subscription event is received

Kind: event emitted by Events
Access: public

Param Type Description
id String The id of the channel
userId String The id of the user
kind Number The kind of change (SUBSCRIBE: 4, UNSUBSCRIBE: 5)

"rainbow_onmediapropose" (infos)

Fired when received an event of propose for media.

Kind: event emitted by Events
Access: public

Param Type Description
infos Object about the proposed for media : { Contact } infos about the contact who proposed for media { media } infos about media for the proposed event.

"rainbow_oncalllogupdated" (calllogs)

Fired when the calllog is updated

Kind: event emitted by Events
Access: public

Param Type Description
calllogs Object The callogs of the user

"rainbow_oncalllogackupdated" (id)

Fired when the number of ack of calllog changes

Kind: event emitted by Events
Access: public

Param Type Description
id Object The calllog of the user

"rainbow_onfavoritecreated" (favorite)

Fired when a favorite is added to the loggued in user.

Kind: event emitted by Events
Access: public

Param Type Description
favorite Favorite The favorite created

"rainbow_onfavoritedeleted" (favorite)

Fired when a favorite is suppressed to the loggued in user.

Kind: event emitted by Events
Access: public

Param Type Description
favorite Favorite The favorite deleted

"rainbow_onxmpperror" (error)

Fired when an XMPP Error events happens.

Kind: event emitted by Events
Access: public

Param Type Description
error Object xmpp received.

"rainbow_onstarted" (status)

Fired when the SDK has successfully started (not yet signed in)

Kind: event emitted by Events
Access: public

Param Type Description
status Object The event status

"rainbow_onstopped" (status)

Fired when the SDK has been successfully stopped (all services have been stopped)

Kind: event emitted by Events
Access: public

Param Type Description
status Object The event status

"rainbow_onconnected" (status)

Fired when the connection is successfull with Rainbow (signin complete)

Kind: event emitted by Events
Access: public

Param Type Description
status Object The event status

"rainbow_onconnectionerror" (status)

Fired when the connection can't be done with Rainbow (ie. issue on sign-in)

Kind: event emitted by Events
Access: public

Param Type Description
status Object The event status

"rainbow_ondisconnected" (status)

Fired when the SDK lost the connection with Rainbow

Kind: event emitted by Events
Access: public

Param Type Description
status Object The event status

"rainbow_onreconnecting" (status)

Fired when the SDK tries to reconnect

Kind: event emitted by Events
Access: public

Param Type Description
status Object The event status

"rainbow_onfailed" (status)

Fired when the SDK didn't succeed to reconnect and stop trying

Kind: event emitted by Events
Access: public

Param Type Description
status Object The event status

"rainbow_onready" (status)

Fired when the SDK is connected to Rainbow and ready to be used

Kind: event emitted by Events
Access: public

Param Type Description
status Object The event status

"rainbow_onerror" (error)

Fired when something goes wrong (ie: bad 'configurations' parameter...). Used by application to stop, start the sdk again.

Kind: event emitted by Events
Access: public

Param Type Description
error Object The error received
Clone this wiki locally