Not logged in. · Lost password · Register
Forum: MatriX RSS
Avatar
atulloona #1
Member since Jun 2015 · 6 posts
Group memberships: Members
Show profile · Link to this post
Subject: Some issue while connecting to GCM server
Hello,

I have been trying to connect to google gcm server, unfortunatly i am not able to connect, here is piece of code to connect

  1. xmppClient.SetUsername("xxxxxxxx@gcm.googleapis.com");
  2. xmppClient.Port = 5235;
  3. xmppClient.XmppDomain = "gcm.googleapis.com";
  4. xmppClient.Password = "YYYYYYYYYYYYYYYYYYYYYY";
  5.  
  6. xmppClient.Status = "I'm chatty";
  7. xmppClient.Show = Matrix.Xmpp.Show.None;
  8.  
  9. xmppClient.Open();

Each time OnSendXml events fire and i get the following text

  1. <stream:stream
  2. xmlns:stream="http://etherx.jabber.org/streams"
  3. xmlns="jabber:client"
  4. to="gcm-preprod.googleapis.com"
  5. version="1.0" >

after this OnStanzaSent, OnClose events fires

i have no clue what going ,please guide.

Thanks
Atul Loona
This post was edited 2 times, last on 2015-06-26, 13:37 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
The server is disconnecting you immediately because you don't connect with SSL.

This is from the the Google GCM XMPP docs:

Quote by developers.google.com/cloud-messaging/ccs:
You must initiate a Transport Layer Security (TLS) connection. Note that CCS doesn't currently support the STARTTLS extension.

Just add:

  1. xmppClient.OldStyleSsl = true;

and it should work fine.

Alex
Avatar
atulloona #3
Member since Jun 2015 · 6 posts
Group memberships: Members
Show profile · Link to this post
Thanks Alex its was helpful, please help will following error

  1. xmppClient.SetUsername("<1654519082959>@gcm.googleapis.com");
  2. xmppClient.SetXmppDomain("gcm-preprod.googleapis.com");
  3. xmppClient.Password = "AIzaSyBdQdzrfdgesc2oaP7F-NAZ3gi4qQ";
  4. xmppClient.Port = 5236;
  5. xmppClient.OldStyleSsl = true;

1654519082959 - is server-id
AIzaSyBdQdzrfdgesc2oaP7F-NAZ3gi4qQ -is key

Here are the logs.

  1. SEND: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="gcm-preprod.googleapis.com" version="1.0" >
  2.  
  3. RECV: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="gcm-preprod.googleapis.com" id="C1DC3349FR0EE97A" version="1.0" xmlns="jabber:client" >
  4.  
  5. RECV: <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  6.  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
  7.     <mechanism>X-OAUTH2</mechanism>
  8.     <mechanism>X-GOOGLE-TOKEN</mechanism>
  9.     <mechanism>PLAIN</mechanism>
  10.  </mechanisms>
  11. </stream:features>
  12. SEND: <auth mechanism="PLAIN" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">ADEwMTc1MTkwODI5NTlcNDB3E20uZ2WsZ2xlYXBpcy5jb20AQUl6YVN5QmRRZHphSU9BSGdy22V0Z2Myb2FQN0YtTkFddfwdNHFR</auth>
  13. RECV: <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
  14.  <not-authorized />
  15. </failure>

Wondering why there are two consecutive RECV, https://developers.google.com/cloud-messaging/ccs

http://xmpp.org/extensions/xep-0106.html

Regards
Atul
This post was edited 4 times, last on 2015-06-26, 23:47 by Alex.
Avatar
Alex #4
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
  • The username should be without the angle brackets (< and >)
  • When you set it with SetUsername then MatriX escapes it. I think Google wants it without Jid escaping. So use the Username property instead.

Alex
Avatar
atulloona #5
Member since Jun 2015 · 6 posts
Group memberships: Members
Show profile · Link to this post
Subject: Thanks a lot it worked  :-)
Thanks a lot it worked  :-)
Avatar
Alex #6
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Great to hear.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: MatriX RSS