Project

General

Profile

how to send messages to offline users using Tigase Http Rest Api[Format = JSON]

Parvinder Singh
Added almost 4 years ago

Hi,

I want to know how to send messages to offline users.


Replies (2)

Added by Wojciech Kapcia TigaseTeam over 3 years ago

Currently only broadcasting messages to Online users is supported. If you want to send messages to All users you should either create new groovy admin ad-hoc script or modify existing one. Issue was discussed here: https://projects.tigase.org/boards/4/topics/755

Added by Parvinder Singh over 3 years ago

Hmm, thats what i did.

In that case need to remove res.setPacketTo.

def userList=user_repo.getUsers()
for(BareJID value : userList){
    def res = msg.copyElementOnly()
    res.initVars(jidFrom, JID.jidInstanceNS(value.toString()))
    res.setPacketTo(JID.jidInstanceNS(fromJid))
       results += res

}
return (Queue)results

Instead of this i used.

def userList=user_repo.getUsers()
for(BareJID value : userList){
    def res = msg.copyElementOnly()
    res.initVars(jidFrom, JID.jidInstanceNS(value.toString()))
    //res.setPacketTo(JID.jidInstanceNS(fromJid))
       results += res

}
return (Queue)results

It worked.

    (1-2/2)