[How To] How to enable websockets (xmpp-websocket) and smacks for Prosody

@corby thanks for this post,
in secure domain do we need also add this config to guest virtual host as well? I see you mentioned jibri!
I’m planning to implement this feature and test it. because also my instance suffers from this issue people get disconnected many times during the conference.

How can I test if xmpp-websocket is used or not by my server?

I see this massage on my browser:

I cannot get a response from the websocket within Jitsi-meet javascript.
web_1 | 195.135.251.189 - - [09/Feb/2021:18:11:38 +0100] “GET /xmpp-websocket?room=test HTTP/1.1” 403 284 “-” “Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Firefox/78.0”

However a http/2 call from the browser works:

web_1 | 195.135.251.189 - - [09/Feb/2021:18:12:19 +0100] “GET /xmpp-websocket HTTP/2.0” 200 152 “-” “Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Firefox/78.0”

My conclusion is that the javascript cannot open a http/2 connection to the websocket.

why is this working for you? old browsers? mine is firefox 85 or chrome 88 which are stuck on http/2

the nginx rule for /xmpp-websocket contains proxy_http_version 1.1;

Hi,

I have same problem. I can enable smack for auth user. Also I add Smack pluging at guest domain to.

VirtualHost “guest.meet.com
authentication = “anonymous”
modules_enabled = {
“pinger”;
“smacks”;
}

At that point I can see smacks messages at websocket when i join the room as guest user. However, I can not resume conference if there is a connection failure. I get that error

<resume h=‘25’ previd=‘db78152f-fdf8-47db-b0b2-75d61fc9138f’ xmlns=‘urn:xmpp:sm:3’
Tried to resume non-existent session with id db78152f-fdf8-47db-b0b2-75d61fc9138f

with the smacks config inside the virtualhost definition I got error messages on the client side in the browser console that smacks is not working.
After moving the smacks config to the global prosody.cfg.lua the error messages vanished and smacks seems to work.

Yes I can manage to work when i move smacks config to global side… But still can not resume for guest users. I explain situation here → How to use Smacks Plugin + Websocket with Anonymous Domains

Hi @engesin , you get xmpp-websocket and smacks working?

hi @Yassine

Yes I can. All details are as follows

I set “smack” to global plugin of prosody rather than virtual host plugin.

could you share the steps and tips? thank you in advance!

@engesin you mean you enabled the the plugings websocket and smaks in /etc/prosody/prosody.cfg.lua right?

-- This is the list of modules Prosody will load on startup.
-- It looks for mod_modulename.lua in the plugins folder, so make sure that exists too.
-- Documentation for bundled modules can be found at: https://prosody.im/doc/modules
 modules_enabled = {

        -- Generally required
                "roster"; -- Allow users to have a roster. Recommended ;)
                "saslauth"; -- Authentication for clients and servers. Recommended if you want to log in.
                .
                .
                .
        -- HTTP modules
                --"bosh"; -- Enable BOSH clients, aka "Jabber over HTTP"
                "websocket"; -- XMPP over WebSockets
                "smacks";
                --"http_files"; -- Serve static files from a directory over HTTP

Yes exactly :+1:

Thanks Bro!

also these variables I guess should be added on /etc/prosody/prosody.cfg.lua :

modules_enabled = {
.
.
.
}
smacks_max_unacked_stanzas = 5;
smacks_hibernation_time = 60;
smacks_max_hibernated_sessions = 1;
smacks_max_old_sessions = 1;

Yes true,

However I set

smacks_max_unacked_stanzas = 3;
smacks_hibernation_time = 60;
smacks_max_hibernated_sessions = 100;
smacks_max_old_sessions = 100;

especially setting session to 1 is weird. there may multiple failure at the same time so I set session values as 100. If anyone figure out effect of that, welcomed…

1 Like

You can have problems with jibri as they use the same username, same jid. The values mentioned, I think, are those running on meet.jit.si for an year now and we haven’t seen problems (except jibri and we adjusted the values). I can double check later …

could you confirm if these values are ok?

smacks_max_hibernated_sessions = 100;
smacks_max_old_sessions = 100

Thanks!

1 Like

smacks_max_hibernated_sessions = 1 in general section (default for all).

For the recorder.your.domain virtualhost you can set smacks_max_hibernated_sessions = 1000 if you have less than 1000 jibris.

smacks_max_old_sessions = 1; is fine.

I applied these variables on the global config : /etc/prosody/prosody.cfg.lua not on mydomain-config.lua.
is this make a sense? or in each virtual host, main one, guest and recoder I need put these variables?

Big thanks :slight_smile:

Only this in the recorder one. the rest globally is ok.

1 Like

Hello,

I followed all your process and I can’t start websocket …

Who can help me please ?

Thanks

hi,

check this post → [How To] How to enable websockets (xmpp-websocket) and smacks for Prosody