Send large text using asmack

I use asmack to create a jabber client for android, it works well, but I had a problem sending large text in Chinese. XMPPConnection immediately disconnected from the server, here are my connection initialization codes:

   ConnectionConfiguration c = new ConnectionConfiguration(mServerAddress, mPort); 
   c.setSecurityMode(SecurityMode.disabled);
   c.setReconnectionAllowed(true);
   c.setCompressionEnabled(false);   
   mConn = new XMPPConnection(c);

and I send a chat message as follows:

   final Message msg = new Message(chatMsg.getTo(), Message.Type.chat);
   msg.setBody(chatMsg.getBody());

   new Thread() {
 @Override
 public void run() {
  if(mConn != null && mConn.getUser() != null) {
   mConn.sendPacket(msg);
  }
 }
   }.start();
+3
source share

Source: https://habr.com/ru/post/1785870/


All Articles