AnsweredAssumed Answered

Message BUg

Question asked by Yrii on Oct 3, 2015

If i use Smaks 3.0

 

  • config = new ConnectionConfiguration(GCM_SERVER, GCM_PORT);
  •   config.setSecurityMode(SecurityMode.enabled);
  •   config.setReconnectionAllowed(true);
  •   config.setRosterLoadedAtLogin(false);
  •   config.setSendPresence(false);
  •   config.setSocketFactory(SSLSocketFactory.getDefault());
  •   System.out.println("Тест - ");
  •   // NOTE: Set to true to launch a window with information about packets
  •   // sent and received
  •   config.setDebuggerEnabled(true);
  •   // -Dsmack.debugEnabled=true
  •   XMPPConnection.DEBUG_ENABLED = true;
  •   connection = new XMPPConnection(config);
  •   connection.connect();
  • // Handle incoming packets
  •   connection.addPacketListener(new PacketListener() {
  •   @Override
  •   public void processPacket(Packet packet) {
  •   logger.log(Level.INFO, "Received: " + packet.toXML());
  •    //....

 

Received good:

 

<message to="46593557899788@gcm.googleapis.com" from="devices@gcm.googleapis.com" type="normal"><gcm xmlns="google:mobile:data">{"data":{"message-x":"222","action-x":"111"},"time_t o_live":10000,"from":"c_4GULEdFUk:APA91bEy5YiWT0qXpMgjjTvDB0UUsLlFUT5Fp4jClK_-fi OeP-ZWBa_1ttOb9ykWNLG5gxUBYKH1HSgOLqZ9Tzwy0NdGgyn4ZheCgL64JlwHtxyRaQRHBGCQHlia3e maCU4An_EVV","message_id":"1","category":"ru.sendim_testclomessaging.com.sendim" }</gcm></message>

 

 

if i use Smaks 4.1.4

 

  • config = XMPPTCPConnectionConfiguration.builder()
  •    //Базовыйе настройки
  •    .setUsernameAndPassword("465935512265@gcm.googleapis.com", "AIzaSyAZtMWJRtjyJcWYAubN0IahfZFx4BCEJ8g")
  •    .setServiceName("gcm.googleapis.com")
  •    .setHost("gcm.googleapis.com")
  •    .setPort(5235)
  •    //.setResource("test")
  •   
  •    .setDebuggerEnabled(true)
  •           .setSendPresence(false) 
  •           .setSocketFactory(SSLSocketFactory.getDefault())
  •           .setSecurityMode(XMPPTCPConnectionConfiguration.SecurityMode.ifpossible)
  •    .build();
  •   conn2 = new XMPPTCPConnection(config);
  •   setRoster(conn2);//
  •   conn2.setPacketReplyTimeout(10000);
  •     conn2.connect();
  • myListener = new StanzaListener() {
  •   @Override
  •   public void processPacket(Stanza arg0) throws NotConnectedException {
  •   // TODO Auto-generated method stub
  •   System.out.println("888 message4445 - "+arg0);
  •   }};
  •   conn2.addSyncStanzaListener(myListener,message_filter);

 

 

Received NOT good:

<message to='465935512265@gcm.googleapis.com' from='devices@gcm.googleapis.com' type='normal'><gcm xmlns='google:mobile:data'></gcm></message>

 

Why?

Outcomes