Jitsi Meet API Connecting From Web App Not working

I have the following as vanilla Javascript:

JitsiMeetJS.init()

        const connectionConfig = {
            serviceUrl : 'wss://meet.example.com/xmpp-websocket', //also testing https://meet.example.com/http-bind
            hosts : {
                domain : 'meet.example.com',
            }
        };
        const connection = new JitsiMeetJS.JitsiConnection(null, undefined, connectionConfig);

        connection.addEventListener(
            JitsiMeetJS.events.connection.CONNECTION_ESTABLISHED, function() {
                console.log('Succedded');
            });
          connection.addEventListener(JitsiMeetJS.events.connection.CONNECTION_FAILED, function() {
              console.log("Failed");
          });
          connection.connect();

I am also trying to connect with:

https://meet.example.com/http-bind

In my /etc/prosody/prosody.cfg.lua I’ve added the following 2 lines:

cross_domain_bosh **=** **true**
consider_bosh_secure **=** **true**

And it in my nginx conf, I’ve noted the following:

# BOSH
    location = /http-bind {
        proxy_pass      http://localhost:5280/http-bind;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header Host $http_host;
    }

    # xmpp websockets
    location = /xmpp-websocket {
        proxy_pass http://127.0.0.1:5280/xmpp-websocket?prefix=$prefix&$args;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $http_host;
        tcp_nodelay on;
    }

No when I try to connect with wss I get this:

2020-09-27T20:08:52.913Z [modules/statistics/statistics.js] <Function.b.sendAnalyticsAndLog>: {"type":"operational","action":"connection.failed","attributes":{"error_type":"connection.otherError","error_message":"The WebSocket connection could not be established or was disconnected.","suspend_time":0,"time_since_last_success":null}}

And when I try to connect with the https url via js code above, I get nothing back at all. But when I go to it from my browser I get;

It works! Now point your BOSH client to this URL to connect to Prosody.

Both the nginx and prosody logs are not recording anything. Am I doing something wrong?

1 Like