Skip to content

Instantly share code, notes, and snippets.

@phm200
Created May 30, 2018 19:54
Show Gist options
  • Save phm200/f05cb64a1655de12d5fd5b71c2dcff56 to your computer and use it in GitHub Desktop.
Save phm200/f05cb64a1655de12d5fd5b71c2dcff56 to your computer and use it in GitHub Desktop.
Streams PR #64 - Application Code
// api.js
Contact.prototype.onSession = function(f) {
var bus = connect.core.getEventBus();
bus.subscribe(this.getEventName(connect.ContactEvents.SESSION), f);
};
...
// application code
function subscribeToContactEvents(contact) {
...
contact.onSession(handleContactSession);
}
function handleContactSession(session) {
var rtcSession = session;
// do something with the RTCSession
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment