Quantcast
Channel: Ignite Realtime : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 10742

GCM connection using Smack

$
0
0

Hi there.

 

I'm trying to use the library to connect to GCM server exactly like google indicates http://developer.android.com/google/gcm/ccs.html#implement

 

But when I connect using debug I can see that sequency

 

Client sends:

<stream:streamto="gcm.googleapis.com"version="1.0"xmlns="jabber:client"xmlns:stream="http://etherx.jabber.org/streams">

 

Server:

<str:featuresxmlns:str="http://etherx.jabber.org/streams">
<mechanismsxmlns="urn:ietf:params:xml:ns:xmpp-sasl">
  
<mechanism>X-OAUTH2</mechanism>
  
<mechanism>X-GOOGLE-TOKEN</mechanism>
  
<mechanism>PLAIN</mechanism>
</mechanisms>
</str:features>

 

Client:

<authmechanism="PLAIN" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">MTI2MjAwMzQ3OTMzQHByb2plY3RzLmdjbS5hbmFTeUIzcmNaTmtmbnFLZEZiOW1oekNCaVlwT1JEQTJK V1d0dw==</auth>

</stream:stream>

 

As can you see, the close tag stream is sent after the auth, the specification requires this sequence:

See? the stream tag is auto closed, I thing the problem is there.

Client

<stream:streamto="gcm.googleapis.com"
       
version="1.0"xmlns="jabber:client"
       
xmlns:stream="http://etherx.jabber.org/streams"/>

Server

<str:featuresxmlns:str="http://etherx.jabber.org/streams">
<mechanismsxmlns="urn:ietf:params:xml:ns:xmpp-sasl">
  
<mechanism>X-OAUTH2</mechanism>
  
<mechanism>X-GOOGLE-TOKEN</mechanism>
  
<mechanism>PLAIN</mechanism>
</mechanisms>
</str:features>

Client

<authmechanism="PLAIN"
xmlns="urn:ietf:params:xml:ns:xmpp-sasl">MTI2MjAwMzQ3OTMzQHByb2plY3RzLmdjbS5hb
mFTeUIzcmNaTmtmbnFLZEZiOW1oekNCaVlwT1JEQTJKV1d0dw==
</auth>

Server

<successxmlns="urn:ietf:params:xml:ns:xmpp-sasl"/>

 

 

 

Basicaly the implementarion is this:

 

      ConnectionConfiguration config = new ConnectionConfiguration(GCM_SERVER, GCM_PORT);

        config.setSecurityMode(SecurityMode.enabled);

        config.setReconnectionAllowed(true);

        config.setRosterLoadedAtLogin(false);

        config.setSendPresence(false);

        config.setCompressionEnabled(true);

        config.setSocketFactory(SSLSocketFactory.getDefault());


        connection = new XMPPTCPConnection(config);

        connection.connect();

        connection.login(user, pwd);

 

 

I'm using version 4, using version 3 the tag stream is not even closed


Viewing all articles
Browse latest Browse all 10742

Trending Articles