WrathChaos / StompClientLib

Simple STOMP Client library, Swift 3 and 4, 4.2, 5 compatible
https://www.freakycoder.com
MIT License
154 stars 81 forks source link

Auto disconnect, without pinging #129

Closed teendream closed 1 month ago

teendream commented 1 month ago

I have issue, where ping method is not working and socket automatically disconnects

   let socketClient = StompClientLib()

    let url = URL(string: "*****")!

    let headers = [
        "login" : "****",
        "passcode" : "*****",
        "host" : "/",
        "accept-version" : "1.1"
    ]

    func configureSocket() {
        socketClient.openSocketWithURLRequest(request: NSURLRequest(url: url) , delegate: self, connectionHeaders: headers)
    }

    func stompClient(client: StompClientLib!, didReceiveMessageWithJSONBody jsonBody: AnyObject?, akaStringBody stringBody: String?, withHeader header: [String : String]?, withDestination destination: String) {
        print("received message")
    }

    func stompClientDidDisconnect(client: StompClientLib!) {
        print("disconnect")
    }

    func stompClientDidConnect(client: StompClientLib!) {
        print("connected")

        let destination = "/topic/session-kkm-bill-*****"
        let id = "sub-0"
        let header = ["destination": destination, "id": id]

        socketClient.subscribeWithHeader(destination: destination, withHeader: header)
    }

    func serverDidSendReceipt(client: StompClientLib!, withReceiptId receiptId: String) {
        print("send receipt")
    }

    func serverDidSendError(client: StompClientLib!, withErrorMessage description: String, detailedErrorMessage message: String?) {
        print(description)
    }

    func serverDidSendPing() {
        print("send ping")
    }