Quantcast
Channel: Ignite Realtime: Message List
Viewing all articles
Browse latest Browse all 12162

Re: [Openfire API] Sending message to all users

$
0
0

Thanks for your reply. I started learning IQ and below is my function. Im trying to send a ping to a client. However, when I execute it, client receive nothing. Any idea why ?

 

   public void sendMessage(String from, String to) {

      final Message message = new Message();

      final XMPPServer xmppServer = XMPPServer.getInstance();

      JID toAddress = new JID(to+"@"+serverName);

      JID fromAddress = new JID(from+"@"+serverName);

     

      //message.setTo(toAddress);

      //message.setFrom(fromAddress);

      //message.setSubject(getSubject());

      //message.setBody(getMessage());

     

      // For testing purpose

      IQRouter iqRouter = XMPPServer.getInstance().getIQRouter();

      IQ iq = new IQ();

      iq.setTo(toAddress);

      iq.setFrom(fromAddress);

      iq.setType(IQ.Type.get);

      iq.setChildElement("ping","urn:xmpp:ping");

 

      iqRouter.route(iq);

     

      //router.route(message);

   }


Viewing all articles
Browse latest Browse all 12162

Trending Articles