There was some confusion over this scentence in the Google Documentation:
CCS requires a Transport Layer Security (TLS) connection. That means the XMPP client must initiate a TLS connection.
In relation to agsXMPP, this means UseSSL
and not UseStartTLS
. I had both set to true, but UseStartTLS
sets UseSSL
to false. Google closes the connection on a non-SSL connection. Setting UseStartTLS to false (even though the docs talking about initating with a TLS connection) - will allow a SSL connection to establish, and the connection can setup normally.
Working code:
xmpp = new XmppClientConnection
{
UseSSL = true,
UseStartTLS = false,
Server = "gcm.googleapis.com",
ConnectServer = "gcm.googleapis.com",
Port = 5235,
Username = "<SENDER ID>@gcm.googleapis.com",
Password = <KEY>,
AutoResolveConnectServer = false,
SocketConnectionType = SocketConnectionType.Direct,
KeepAlive = true,
};
xmpp.Open();