-
Notifications
You must be signed in to change notification settings - Fork 217
Closed
Labels
Description
Steps to reproduce the error modifying the main.js in your peer-to-peer example.
- Add this line in the QB.webrtc.onRejectCallListener callback function:
throw "We have an error!";- Now, call someone using the peer-to-peer code.
- When there is an incoming call click 'Reject'
- This will work correctly the first time but Strophe's handlers are removed when this happens. The exception thrown slips by unnoticed.
- Call that same person again (don't reload the browsers)
- Click 'Reject' again
- When you're clicking Reject now, it won't correctly send the message to QuickBlox to handle the reject response.
- It goes into an infinite loop where you keep clicking Reject ad infinitum.
I had an undefined variable in the onRejectCallListener but the error gets trapped within Strophe's try...catch block and it never gets reported to QuickBlox.
The big issue is that Strophe suddenly removes all of its handlers.
TypeError: Cannot read property 'full_name' of undefined
at WebRTCProxy.QB.webrtc.onRejectCallListener (http://www.domain.com/assets/js/chat/main.js:283:93)
at Object.8.conn._onMessage [as handler] (http://www.domain.com/assets/js/quickblox/quickblox.js:1920:14)
at Object.15.h.Handler.run (http://www.domain.com/assets/js/quickblox/quickblox.js:3041:16841)
at http://www.domain.com/assets/js/quickblox/quickblox.js:3041:24530
at Object.15.h.forEachChild (http://www.domain.com/assets/js/quickblox/quickblox.js:3041:9327)
at Object.15.h.Connection._dataRecv (http://www.domain.com/assets/js/quickblox/quickblox.js:3041:24363)
at Object.15.a.Websocket._onMessage (http://www.domain.com/assets/js/quickblox/quickblox.js:3042:18519)"
VM1936:1 2 "Removing Strophe handlers due to uncaught exception: Cannot read property 'full_name' of undefined"
Well.. removing the invalid code fixed my problem. if anyone else runs into unexpected behavior, turn on Strophe's logging for yourself.
Strophe.log = function(level, msg) { console.log(level, msg); };And, if you put in a try...catch around all your callbacks you can trap these kind of errors so Strophe doesn't remove its handlers.