We are moving to a new platform to serve you better! Stay tuned and watch out for our email on your inbox! [close]
Start a new topic

Infinite readyStateChange loop when joining the room

It's now recommended to use the init() callback instead of using readyStateChange event state to go completed as this may result in an infinite loop.

Ready state change triggers whenever the current room information is retrieved, and joining another room instead of the default room will result in a re-retrieval to the API server, causing readyStateChange to trigger again and making SkylinkJS to re-join the room over and over again.

// Use this
sw.init(data, function () {

// Instead of
sw.on('readyStateChange', function (state) {
  if (state === sw.READY_STATE_CHANGE.COMPLETED) {

Login or Signup to post a comment