Can not subscribe to channel from NodeJS


I’m getting the error {“type”:“TransportError”,“description”: 503}, while trying to connect to channel.

Also tried using REST and in web, and everything works.

const Backendless = require(‘backendless’);

Backendless.initApp(process.env.APP_ID, process.env.JS_KEY);

const channel = Backendless.Messaging.subscribe(‘default’);

Node - v8
Backendless - latest

Hi @Serge_Zenchenko

On which line does the error message appear?

Hi, on line 5.

I think the error is occurred, while socket handshaking.

You have
function onMessage (message) {
console.log (“Message received:” + message)

as described here - ?

Can you run in debug mode and see where the error occurs?

Even if you will delete the message listener, you will get the error, which is thrown by, while trying to handshake.

One of the SDK dependencies is backendless-rt-client, which is establishing socket connection with Backendless.

In backendless-rt-client check src/socket.js, the error is logged (not thrown) from there, line 98.

Hi @Serge_Zenchenko
the issue has been solved, could you confirm it please?
Regards, Vlad

Hi @vladimir-upirov,

Yes, it works now. Thanks.

Hi @vladimir-upirov,

I’m having the exact same issue with the SDK version 5.2.13.
I notice a GET request being repeteadly invoked ( /rt/lookup ) which doesn’t return error code but 200 and a response like “”.

Publish API seems to work properly though.

Hi @Enrique_Diaz

I just checked it, and looks like there are not any issue, everything works well

  1. add a simple code into “./server/index.js” file :

     const Backendless = require('backendless');
     Backendless.initApp('YOUR_APP_ID', 'YOUR_JS_API_KEY');
     const channel = Backendless.Messaging.subscribe('default');
     channel.addMessageListener(message => console.log('message:', message));
  2. run it: node server

  3. publish a new message, and in terminal output the new messages appear

could you please provide steps to reproduce and env when do you run your code

Regards, Vlad

Sure, I’ll try to be as specific as possible. My project is based on Angular 7 + Ionic 4.

The MessagingService provides a function to post and subscribe to channels.
import {Injectable} from ‘@angular/core’;
import * as Backendless from ‘backendless’;

    providedIn: 'root'
export class MessagingService {

    public getConversationChannel(channelId): Backendless.ChannelClass {
        return Backendless.Messaging.subscribe(channelId);

    public postMessage(message) {
        return Backendless.Messaging.publish('default', message);

At my page/component layer, only 2 buttons are displayed: Join (subscribes to a channel [NOT WORKING]) and Post (posts into the channel).

        <ion-buttons slot="start">
            <ion-back-button defaultHref="/"></ion-back-button>

    <button (click)="initChannel()">JOIN</button>
    <button (click)="postMessage()">POST</button>

The TypeScript functions:

    private conversationChannel;
    initChannel() {
           this.conversationChannel = this.messagingService.getConversationChannel('default');

        this.conversationChannel.addMessageListener((message) => {
            console.log('RT Received: ', message);

    postMessage() {
        this.messagingService.postMessage('hello world!');

Check what’s happening (I’ll attach to this reply some screenshots [I tried but not granted due to “new user”. Sorry about that]):

  1. Open the Chat page.
  2. Click on the JOIN button. Tries to subscribe doesn’t join to the channel. The /lookup API request starts to be invoked infinitely.
  3. Verified the channel subscription state: Not joined.
  4. Click the POST button and successfully posts the message. Verified in Backendless console.

I assume I’m missing something, but cannot mind what.
Thanks in advance!

actually, the topic title says that issue is in NodeJS env, but you’ve got a problem in Ionic env, so it’s a little different problem

anyways, let’s try to figure out what’s going on here

could you please archive your project (or create another one with minimal code) for reproduce the problem and send it to us, also please attach instruction how to install/run the app and we will take a look at the issue

and also you can try to enable debug mode, for that just add the next line right after Backendless.initApp(…)
Backendless.debugMode = true
maybe, there will be some helpful info

Regards, Vlad

I assumed that Backendless JS SDK worked the same for NodeJS, Angular, etc.

I’ll make a small project including what you request and be in touch!

Hi @vladimir-upirov,
I sent an email to on July 18th but I haven’t received any response yet. Is there any update regarding my ticket?


Hello @Enrique_Diaz
Sorry for the late response,
I’ve found the problem, the issue is with Angular and SocketIO library which is used in our JS-SDK

the latest comment looks like fixes the problem, just add the following line in …/src/polyfills.ts file

(window as any).global = window;

Regards, Vlad

1 Like


Thank you so much for the response. I applied the suggested workaround and it does work now as expected.


1 Like

Hi there,

I have the same issue in an Angular app where I am not receiving any messages.

The message is published (can see it in the backendless dashboard) but the message listener never receives it. There is no console error and I’ve tried the polyfill fix but no luck.

Any ideas or help would be great.

Angular: 9.0.7
backendless: 5.8.8

Hello @Iain_Todd

try to add the following code right after Backendless.initApp to check the JS-SDK able to connect to RT-Server

Backendless.RT.addConnectErrorEventListener((...args) => console.log('addConnectErrorEventListener', ...args));
Backendless.RT.addConnectEventListener((...args) => console.log('addConnectEventListener', ...args));
Backendless.RT.addDisconnectEventListener((...args) => console.log('addDisconnectEventListener', ...args));
Backendless.RT.addReconnectAttemptEventListener((...args) => console.log('addReconnectAttemptEventListener', ...args));

Regards, Vlad

Thanks for the responsive reply @vladimir-upirov,
I’m seeing this in the console now…

addConnectErrorEventListener Cannot read property 'Blob' of undefined
addReconnectAttemptEventListener 1 400
addConnectErrorEventListener io is not a function
addReconnectAttemptEventListener 2 400
addConnectErrorEventListener io is not a function
addReconnectAttemptEventListener 3 400
addConnectErrorEventListener io is not a function

it seems like it’s related to Backendless RT not working for me in JS SDK

we will investigate it and notify you about any result asap