Project

General

Profile

tigase server(v7.1.0) and client(v3.0.0) incompatibility

Gagan Malik
Added about 2 years ago

We are testing an upgrade from Tigase v5.2.3 to v7.1.0 and are running into some compatibility issues with the Tigase JaXMPP client library. Our android clients using v3.0.0 of the JaXMPP lib are unable to connect to Tigase v7.1.0. I'm going to paste the problem details as reported by one of our android developers below, after the question..

Is there a compatibility mode or a configuration parameter that we can set in v7.1.0 to make the client v3.0.0 work? Or the client lib v3.0.0 too old to work with Tigase v7.1.0? Or are we missing something very trivial?

Details by android dev as follows..

Client requesting change of protocol sends the following:
GET / HTTP/1.1
Host: <host_url>
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Key: <key>
Sec-WebSocket-Protocol: xmpp,xmpp-framing
Sec-WebSocket-Version: 13

The response by tigase v5.2.3:
HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, OPTIONS
Access-Control-Allow-Headers: Content-Type
Access-Control-Max-Age: 86400
Sec-WebSocket-Protocol: xmpp
Sec-WebSocket-Accept: <string>

The response by tigase v7.1.0:
HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, OPTIONS
Access-Control-Allow-Headers: Content-Type
Access-Control-Max-Age: 86400
Sec-WebSocket-Protocol: xmpp-frame
Sec-WebSocket-Accept: <string>

"The difference in the Sec-WebSocket-Protocol from xmpp to xmpp-frame is making the client change to rfcCompatible mode, but the client freezes and isn't able to establish a connection."

Any help is appreciated.

Thanks!


Replies (4)

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam about 2 years ago

Normally, if XMPP protocol is used there re no incompatibilities between different XMPP servers and XMPP clients, or different versions. This is because all our software implement all the standard XMPP specifications and public extensions.

However, you are not using an XMPP protocol. Instead, you use Websockets and there, indeed were significant changes in the Websockets implementation in both the Tigase server and our library. This is because when we started supporting Websockets connection, the websockets specification was not even finalized yet, so changes are related to changes in specification and also, there were many improvements in the web socket handling by our software.

Our Websocket expert who implemented the protocol on the server and client is on holiday this week and he is back next week. He might offer better suggestions that I can. My suggestions would be:

  1. Use XMPP protocol instead of Websockets if possible. Do you really need to use Websockets in your Android client? It is much less efficient than standard XMPP connection and mobile devices can easily handle standard XMPP connections, so they do not need to use HTTP or Websockets. Unless, of course, you have a very specific use-case.

  2. If you really must use Websockets, then the best option would be to upgrade the library as well, when you switch to the new Tigase XMPP Server version.

  3. Wait until Monday, maybe Andrzej who implemented websockets in our software would have other solution for you.

Added by Gagan Malik about 2 years ago

Thank you Arthur for a quick, detailed response. We will wait for Andrzej's suggestion.

Added by Andrzej Wójcik IoT 1 CloudTigaseTeam about 2 years ago

I think I may know what is happening here. If I'm correct in rfcCompatible mode Jaxmpp uses WebSocket connection as specified in RFC. However before version 3.1.0 of Jaxmpp it was sending WebSocket frames with unmasked data and server was accepting it. In Tigase XMPP Server 7.1.0 we started rejecting connections from WebSocket based clients which are sending unmasked data which may lead to such incompatibility. (only if Jaxmpp-J2SE is used).

This change #4068 was introduced during development of Tigase XMPP Server 7.1.0 and Jaxmpp 3.1.0 to make them fully compatible with RFC specifying WebSocket and XMPP-over-WebSocket as they require that server must drop connection from client if it is sending unmasked data.

There are 2 possible solutions:

  • upgrade to Jaxmpp 3.1.x series (current stable version of Jaxmpp)

  • force server to accept unmasked frames from client by adding following line to etc/init.properties file:

Added by Gagan Malik about 2 years ago

Thank you very much Andrzej! The suggested property did the trick. We are going to update the android client to use the latest stable v3.1.5 tigase-client release, but in the meantime, this flag will help us maintain backward compatibility.

    (1-4/4)