Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Is stream management (XEP-0198) supported? #1228

Open
aarjan opened this issue Jul 30, 2023 · 0 comments
Open

Is stream management (XEP-0198) supported? #1228

aarjan opened this issue Jul 30, 2023 · 0 comments

Comments

@aarjan
Copy link

aarjan commented Jul 30, 2023

Hi,

I couldn't find XEP-0198 listed in this wiki, https://github.com/robbiehanson/XMPPFramework/wiki/XEPs.

But, i could see many issues related to stream management discussed here.

I tried this, but i couldn't get any acknowledgements.

      
    func xmppStreamDidAuthenticate(_ sender: XMPPStream) {
        ConnectionManager.instance.status = ConnectionStatus.AUTHENTICATED
        ConnectionManager.instance.connection?.send(XMPPPresence())
        
        ConnectionManager.instance.initManagers()
        ChatManager.instance.sendPendingMessages()
        LogManager.instance.info(message: "Connection Status: Authenticated")
        
        let xmppStreamManagement = XMPPStreamManagement(storage: XMPPStreamManagementMemoryStorage())
        xmppStreamManagement.addDelegate(StreamDelegate.instance, delegateQueue: DispatchQueue.main)
        xmppStreamManagement.automaticallyRequestAcks(afterStanzaCount: 1, orTimeout: TimeInterval(1))
        xmppStreamManagement.autoResume = true
        xmppStreamManagement.enable(withResumption: true, maxTimeout: TimeInterval.zero)
        xmppStreamManagement.requestAck()
        xmppStreamManagement.activate(ConnectionManager.instance.connection!)
        xmppStreamManagement.requestAck()

        LogManager.instance.info(message: String(xmppStreamManagement.canResumeStream()))
    }
    
    

class StreamDelegate: NSObject, XMPPStreamManagementDelegate {
    static let instance = StreamDelegate()

    func xmppStreamManagement(_ sender: XMPPStreamManagement, wasEnabled enabled: DDXMLElement) {
        LogManager.instance.info(message: "XXXX")
    }

    func xmppStreamManagementDidRequestAck(_ sender: XMPPStreamManagement) {
        LogManager.instance.info(message: "XXXX")
    }

    func xmppStreamManagement(_ sender: XMPPStreamManagement, wasNotEnabled failed: DDXMLElement) {
        LogManager.instance.info(message: "XXXX")
    }

    func xmppStreamManagement(_ sender: XMPPStreamManagement, stanzaIdForSentElement element: XMPPElement) -> Any? {
        LogManager.instance.info(message: "XXXX")
    }

    func xmppStreamManagement(_ sender: XMPPStreamManagement, getIsHandled isHandledPtr: UnsafeMutablePointer<ObjCBool>?, stanzaId stanzaIdPtr: AutoreleasingUnsafeMutablePointer<AnyObject?>?, forReceivedElement element: XMPPElement) {
        LogManager.instance.info(message: "XXXX")
    }

    func xmppStreamManagement(_ sender: XMPPStreamManagement, didReceiveAckForStanzaIds stanzaIds: [Any]) {
        LogManager.instance.info(message: "XXXX")
    }
}
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant