send and receiving message using smack API

后端 未结 3 2051
北恋
北恋 2021-01-12 00:53

I have setup my open fire(jabber server) on local machine with two user testuser1 and testuser2 .using Spark client both users perform chat without any issue,it\'s nice.

3条回答
  •  终归单人心
    2021-01-12 01:11

    Use below code for sending and receiving message

    @Override
             public void processMessage(Chat chat, Message message) {
                 // Print out any messages we get back to standard out.
                 System.out.println("Received message: " + message);
             }
    
         });
    
    chat.sendMessage("How are you dear !!");
    System.out.println(" Send Message succesfully");
    

    For full code example visit How to send message using smack api

提交回复
热议问题