I fetched History from openfire by installing open fire plugin in the open fire and tried this code.
let iq1 = DDXMLElement(name: "iq")
iq1.addAttribute(withName: "type", stringValue: "get")
iq1.addAttribute(withName: "id", stringValue: "0")
let retrieve = DDXMLElement(name: "retrieve", xmlns: "urn:xmpp:archive")
retrieve?.addAttribute(withName: "with", stringValue: "raman@ip-172-31-53-77.ec2.internal")
let set = DDXMLElement(name: "set", xmlns: "http://jabber.org/protocol/rsm")
let max = DDXMLElement(name: "max", stringValue: "50")
iq1.addChild(retrieve!)
retrieve?.addChild(set!)
set?.addChild(max)
stream?.send(iq1 )
Now i am not getting history from Both Side. here is the result that i get.
<iq xmlns="jabber:client"
type="result"
id="0"
to="bentick@ip-172-31-53-77.ec2.internal/5qsinh1syg">
<chat xmlns="urn:xmpp:archive"
with="raman@ip-172-31-53-77.ec2.internal"
start="2017-02-07T06:28:33.691Z">
<from secs="0">
<body>hello</body>
</from>
<from secs="405">
<body>hiii</body>
</from>
<from secs="580">
<body>Hey</body>
</from>
<from secs="599">
<body>HooooE</body>
</from>
<from secs="628">
<body>hOo</body>
</from>
<from secs="907">
<body>Raman here</body>
</from>
<from secs="931">
<body>Raman here ONE</body>
</from>
<from secs="1273">
<body>Raman here</body>
</from>
<from secs="1558">
<body> Raman from SPark </body>
</from>
<from secs="1571">
<body> Raman from SPark One</body>
</from>
<from secs="1782">
<body>Raman from SPark </body>
</from>
<from secs="2651">
<body>Raman FiVE</body>
</from>
<from secs="2810">
<body>Raman Three</body>
</from>
<from secs="2810">
<body>Raman FOur</body>
</from>
<from secs="3534">
<body>RAMAN SIX</body>
</from>
<from secs="4105">
<body>Raman OKK</body>
</from>
<from secs="4113">
<body>OKKK l</body>
</from>
<from secs="4130">
<body>UST</body>
</from>
<set xmlns="http://jabber.org/protocol/rsm">
<first index="0">0</first>
<last>17</last>
<count>18</count>
</set>
</chat>
</iq>
This is all the message of RAMAN not BENTICk as this two user involved in chatting while getting history i only get the message of RAMAN. not BENTICk How to get history from both side user.
Please help.
I have implemented the same to get the Message to and from by sending the given iq And I am getting the proper result.
Response