Skip to content

Latest commit

 

History

History
31 lines (26 loc) · 5.32 KB

Events.md

File metadata and controls

31 lines (26 loc) · 5.32 KB

Events

JSONgle fires the following events

Events Description
oncall Fired when a new call has been received or when a call is initiated.
The event contains the Call
oncallstatechanged Fired each time there is an update on the current call.
The event contains the new state value
oncallended Fired when a call has ended.
The event contains a boolean indicating if the call has been ended locally (true) or from the remote peer (false)
onofferneeded Fired when a call needs a SDP offer.
The event contains the Call
The application should get the local description (SDP) and answer as soon as possible by calling the method sendOffer with the offer generated from the browser.
onofferreceived Fired when a call received a SDP offer.
The event contains the RTCSessionDescription received from the recipient.
The application should give that offer to the RTCPeerConnection.
oncandidatereceived Fired when a call received an ICE candidate.
The event contains the RTCIceCandidate received from the recipient.
The application should give that candidate to the RTCPeerConnection.
onticket Fired when the call has ended.
The event contains a sum-up of all call information.
oncallmuted Fired when the remote peer has muted the stream on his side.
The event contains the Call
oncallunmuted Fired when the remote peer has unmuted the stream on his side.
The event contains the Call
onlocalcallmuted Fired when the local stream has been muted.
The event contains the Call
onlocalcallunmuted Fired when the local stream has been muted.
The event contains the Call
ondatareceived Fired when a custom message has been received.
The event contains an Object representing the content, a string representing the issuer and a string representing the id.
onmessagereceived Fired when a text message has been received.
The event contains a string representing the content and a string representing the issuer and a string representing the id.
onerror Fired on general error received not linked to an IQ request.
The event contains an Object representing the error and a string representing the issuer (often the server)
onrequest Fired when a request has been received (can be an iq-set or an iq-get).
The event contains an Object representing the request and a string representing the issuer.
Sending an answer using the method answer() is required to fullfil that request.
onevent Fired when an event is received. Come from the server depending on the actions done by other users.
The event contains an Object representing the event and a string representing the issuer.

Here is an example of registering to an event

jsongle.oncallstatechanged = (call) => {
    // The call state has changed. Do something if needed
};