Support Topics Documentation Slack YouTube Blog

Message channel subscription - waitConnection

I am subscribeing to a channel (JS) but channel.isJoined() is always false. The console looks like

  1. n {subscriptions: {…}, simpleListeners: {…}, options: {…}, waitConnection: Array(1), app: e, …}
  2. app: e {__appId: "9A86A9BF- ", __apiKey: “”, __serverURL: “https://api.backendless.com”, __debugMode: false, __standalone: false, …}
  3. connection: null
  4. options: {name: “1408CC84-8042-429A-A07F”}
  5. simpleListeners: {}
  6. subscriptions: {}
  7. waitConnection: Array(1)
    1. 0: ƒ ()
    1. arguments: (…)
    2. caller: (…)
    3. length: 0
    4. name: “r”
    5. prototype: {constructor: ƒ}
    6. proto: ƒ ()
    7. [[FunctionLocation]]: backendless.min.js?&bust=1613057961:15
    8. [[Scopes]]: Scopes[6]
2. length: 1
3. __proto__: Array(0)
  1. commandSender: (…)
  2. commandSubscriber: (…)
  3. connectSubscriber: (…)
  4. usersSubscriber: (…)
  5. proto: t

If I leave the page and come back I get connected…
Any idea what causes the app stying in the waitConnection-status?
regards

Hi @Kurt_Stoller !

Could you please provide sample of code which you have used to subscribe to a channel?

Regards, Andriy

Hi,

chatChannel = Backendless.Messaging.subscribe(chatroomId);

chatChannel.addMessageListener(function(message) {

}

Hello @Kurt_Stoller

Where do you call the isJoined() method?
Make sure you do not run it right after subscribing to a channel, because it takes some time to establish a connection between client and server and before that the isJoined() method returns false

Regards, Vlad

Hi,
Regardless of how many seconds after subscribing I check isjoined I always get ‘false’
setTimeout(function() {
var joined = chatChannel.isJoined();
console.log(joined);
}, 20000);

Hello @Kurt_Stoller,
Unfortunately we cannot reproduce this issue:

Please provide your Application ID and a simple code sample that reproduces the problem.

Regards,
Olha