Connect to FCM with xmpp TLS connection

Hi,

I have been writing an app server to connect to Google firebase message service FCM. With Smack, I can successfully connect but not in a secure way. My configuration is as below and expect it is a secure connection:

f		config = new ConnectionConfiguration(Util.FCM_SERVER, Util.FCM_PORT);
		config.setSecurityMode(SecurityMode.enabled);
		config.setReconnectionAllowed(true);
		config.setRosterLoadedAtLogin(false);
		config.setSendPresence(false);
		config.setSocketFactory(SSLSocketFactory.getDefault());
		// Launch a window with info about packets sent and received
		config.setDebuggerEnabled(mDebuggable);

		fcmClient = new XMPPConnection(config);
		fcmClient.connect();

After connected callback executed, I try to verify the connection with:

fcmClient.isSecureConnection()

and it return false. I trace the code in XMPPTCPConnection.java and found that proceedTLSReceived at line 1057 will never be executed where the eventType name ‘proceed’ is not a type name of FCM per FCM xmpp protocol.

I am new to Smack and xmpp protocol :blush:. Not sure the issue is a bug or feature request or misunderstanding?

  • The used Smack version: smack-4.2.2

Regards,
David

Hi, I have the same problem. FCM do not support STARTTLS extension and it is what you want to do on the initial connection. As I unerstanding we need to initiate TLS just after connection by sending something like is described here: https://xmpp.org/extensions/xep-0035.html.
But I do know how to send this kind of XML. I manage only to send XML with tag message, iq.