Online and Offline users using strophe.js in real time

社会主义新天地 提交于 2019-12-04 13:13:09

You can subscribe to presence for your buddies using this Strophe API:

connection.send($pres({
  to: jid,     // buddy jid
  type: "subscribe"
}));

which implements the XMPP specification (see https://xmpp.org/rfcs/rfc3921.html#int for details). The buddy can accept subscription replying with:

connection.send($pres({
  to: from,  // jid of subscriber
  type: "subscribed"
}));

You can check my web client example based on XMPP (using Strophe.js) on Plunker:

http://plnkr.co/edit/EhQHDsYpDhrECmaaIlZO

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!