DyKnow / SignalR-ObjC

Objective-C Client for the SignalR Project works with iOS and Mac
MIT License
442 stars 213 forks source link

SRHubProxyInterface.invoke - completionHandler called twice #293

Open BRH-Enrian opened 7 years ago

BRH-Enrian commented 7 years ago

I've noticed that my completion handlers for proxy invoke calls get called twice. Here's a snippet from my code:

var counter = 0
proxy.invoke("groupdisconnect", withArgs: [roomId]) { [weak self] response, error in
    guard let wself = self else { return }
    counter += 1
    wself.logger.log("leaveRoom - \(counter) res: \(response.debugDescription) err: \(error.debugDescription)")
    if counter == 2 {
        DispatchQueue.main.async {
            wself.logger.log("disconnecting from hub")
            wself.proxy = nil
            wself.hub?.disconnect()
            wself.hub = nil
        }
    }
}

Here's the log lines from above:

2017-08-17 01:16:58.314 Nedbank[11425:126321] 23:16:58.314 WebSocketClient: leaveRoom - 1 res: nil err: nil
2017-08-17 01:16:58.858 Nedbank[11425:126321] 23:16:58.858 WebSocketClient: leaveRoom - 2 res: nil err: nil

So, is this normal? And why is res always nil?

obzone commented 6 years ago

the same question with me

obzone commented 6 years ago

try to comment out lines from 78 to 80 in "SRWEBSocketTransport" file will fix it