songz/cordova-plugin-opentok

session.connect() breaking changes

fredfortier opened this issue · 1 comments

session.connect() changed. My usual session.connect(apiKey, token) no longer works. It now seems to force me to specify a callback and does not want my api key.

Here is my code now:
session.connect(/*openTokApiKey, */token, function (err) {
if (err) {
console.error('session could not connect', err);
mobile.error('The session could not connect. Please try again later.');
} else {
console.log('session connected');
}
});

What should be the correct syntax? It does not match this document: https://swww.tokbox.com/opentok/libraries/client/js/migrating-to-version-2.2.html. I'd like to avoid having conditional branches for the cordova api vs web JS.

This particular call returns a value in my error parameter. But it's not really an error (I don't think).
Object
connection: Object
connectionId: "EF1BC5F8-EC52-447A-829A-636423C450BB"
creationTime: "1397415207924"
proto: —
connectionCount: "0"
environment: "production"
sessionConnectionStatus: "OTSessionConnectionStatusConnected"
sessionId: "1_MX4yODg3MzgyMn5-U3VuIEFwciAxMyAxMTozMDo0OSBQRFQgMjAxNH4wLjM5MzExNzl-fg"
streams: Array[0]
length: 0
proto: —
proto: —

You are right. I have now changed it to reflect the correct documentation: https://swww.tokbox.com/opentok/libraries/client/js/migrating-to-version-2.2.html

session successful connect callback should not return a value in your error parameter, thank you for catching that
78bff43