[JSXC] Nextcloud JavaScript XMPP Client - Configuring "internal" server for usage

Hey there,

did somebody else try this out: https://github.com/nextcloud/jsxc.nextcloud ?
Looks quite interesting to me, as also integration and collaboration with spreed is planned: Nextcloud Chat and spreed.me

I wanted to give it a try and followed the installation instructions: Install ojsxc (owncloud) · jsxc/jsxc Wiki · GitHub
I found the option to use the “Internal JSXC XMPP server”:

  • I installed the app via app store
  • chose “Internal (Experimental)” in admin panel
  • entered “stun:<my.turnserver.url>:<port>” as TURN url
  • left out TURN username and pw, as my TURN server provides TURN secret
  • added TURN secret and lifetime of 600 seconds, which is standard value in coturn config, as I remember
  • just in case added the following to my nextcloud apache vhost/config:
ProxyPass /http-bind/ http://localhost:5280/http-bind/
ProxyPassReverse /http-bind/ http://localhost:5280/http-bind/
  • I did a logout and login, as suggested in admin panel after settings are saved and was able to.
  • Sadly the chat icon did not show up. If I login “without Chat”, the icon appears, but indeed says that login is needed, which is then not possible by entering the Nextcloud username and password.
  • My browser console shows the following:
jsxc.js?v=9c7a58b…:185 State changed to INITIATING
jsxc.js?v=9c7a58b…:185 State changed to PREVCONFOUND
jsxc.js?v=9c7a58b…:185 check master
jsxc.js?v=9c7a58b…:185 I am master.
jsxc.js?v=9c7a58b…:185 [WARN] xmpp.url required for login
  • I am wondering about “xmpp.url required for login”, as I chose the internal xmpp server and therefore the settings for entering the XMPP domain and BOSH url disappear.

So my questions:

  1. First, is it correct to enter the TURN url like this "stun:<url>:<port>" as the example on empty settings field show? Or should I just use “https://<url>:<port>” as this should be fine read by my TURN server?
  2. Do I still need to install the XMPP/BOSH server, as this is mentioned on top of every install instruction? I highly doubt, as the settings clearly say to use a simple internal server and hides the fields to enter external xmpp/bosh.
  3. It this a bug, related to the browser console, that the internal server setting is not used correctly and the app still looks for the xmpp/bosh entries to start up?

My system:

  • Raspberry Pi 2
  • up to date Raspbian
  • Apache 2.4.25
  • PHP 7.0.17 (same result with 7.0.16)
  • MariaDB 10.0.29
  • Nextcloud 11.0.2 RC2 (same result with 11.0.1)

I had this running fine both with the internal and alternatively a prosody XMPP server (before the internal one was added) a while ago on an older version.

If I recall correctly you only need to set a TURN URL when using an external server, if you use the internal one no additional configuration is needed.

Yes I would have thought so. At least chat should work without any settings on internal server, as everything is related to video call. But as I said, browser console shows the missing xmpp/bosh url error. So this seems to be a bug in this jsxc/nextcloud combination.

Hi. If you want to use the internal XMPP server you don’t have to setup a server or BOSH etc. Also turn/stun configuration isn’t needed. (internal XMPP server doesn’t support WebRTC yet)

You don’t have to follow https://github.com/jsxc/jsxc/wiki/Install-ojsxc-(owncloud) it’s just as simple to enable the app and choose to use the internal server.

I would try to reinstall the app.

Hmm I tried back and forth, reinstalled to app, removed all settings, gave fake settings for bosh/xmpp url, but switched to internal server, logout and in several times, but whatever I do “jsxc.js?v=9c7a58b…:185 [WARN] xmpp.url required for login” shows up and no chat icon there. Same result with different browser.

Sadly I don’t know how the debug it. If I would know where the settings are checked, I could try to fix this by myself, but browser console just directs me to the error message function in jsxc.js.

I tried again after applying the latest commit, since it has to do something with login: https://github.com/nextcloud/jsxc.nextcloud/commit/206d092a999b563dd3f36e48e5dcd88a3493d587

No change in my case. Same browser console error and huh I totally forgot to add the nextcloud log entry that shows up, when I am saving the jsxc settings:

Error PHP preg_match() expects parameter 2 to be string, array given at /var/www/owncloud/apps/ojsxc/ajax/setAdminSettings.php#7

So it is about the parameter “$version”, but I don’t know where this is given. Maybe later that evening I could do some deeper research.

€:
Hmm, since the parameter is expected to be a string I changed line 6
$version = \OCP\Util::getVersion(); into
$version = \OC_Util::getVersionString();

After that a new error appeared on saving settings:

Error PHP preg_match(): No ending delimiter '/' found at /var/www/owncloud/apps/ojsxc/ajax/setAdminSettings.php#7

So I added an “/” at the end of first argument in line 7, as this seems to be needed there (?):

preg_match(‘/^([0-9]+)./’, $version, $versionMatches);

After that no error appears anymore in nextcloud log, but the error in browser console stays and with it no chat icon etc,

I am absolutely no php programmer so maybe my “fixes” are going totally wrong. I hope someone more experienced could look into this :smiley:.

€€:
I checked the mysql table:

| ojsxc | serverType         | internal    |
| ojsxc | types              | prelogin    |

So internal server setting is set correctly, don’t know what this “prelogin” means.

With the newest version v3.2.0-beta.2 as far as I tested, everything works fine now :slight_smile:. Thanks to @sualko for the update!

As on apps.nextcloud.com it is listed as “unstable”, it is so far not possible do update it via app store from out of nextcloud web ui. But you can download the archive and extract the tar.gz and contained tar archive manually to get the ojsxc folder for nextcloud/apps.

€: Okay, while using the internal xmpp server and therefore leaving all admin panel settings empty, I still get some errors:

Error	PHP	Undefined index: timeLimitedToken at /var/www/owncloud/apps/ojsxc/ajax/setAdminSettings.php#34	2017-05-01T18:35:37+0200
Error	PHP	Undefined index: xmppPreferMail at /var/www/owncloud/apps/ojsxc/ajax/setAdminSettings.php#26	2017-05-01T18:35:37+0200
Error	PHP	Undefined index: xmppStartMinimized at /var/www/owncloud/apps/ojsxc/ajax/setAdminSettings.php#25	2017-05-01T18:35:37+0200
Error	PHP	Undefined index: xmppOverwrite at /var/www/owncloud/apps/ojsxc/ajax/setAdminSettings.php#24	2017-05-01T18:35:37+0200
Error	PHP	preg_match() expects parameter 2 to be string, array given at /var/www/owncloud/apps/ojsxc/ajax/setAdminSettings.php#7	2017-05-01T18:35:37+0200
Error	PHP	Use of undefined constant script - assumed 'script' at /var/www/owncloud/apps/ojsxc/templates/settings/admin.php#5	2017-05-01T18:35:22+0200

But chatting nevertheless works, as far as I could test.