AutosoftDMS / SignalR-Swift

SignalR client library written in pure Swift
MIT License
60 stars 55 forks source link

handler(nil, nil) ? #12

Closed olilavoie closed 7 years ago

olilavoie commented 7 years ago

I don't know if it's an issue... or a feature... but I'd like to know why in WebSocketTransport.send method, you call this:

if let handler = completionHandler { handler(nil, nil) }

When we invoke our method to subscribe to notifications, we receive a first callback with nil params (code above) and another one with the result from the server.

When we invoke our method to unsubscribe to notifications, the same callback (subscribe) is call again with handler(nil, nil). This time its the HubProxy->invoke(method: String?, withArgs args: [Any], completionHandler: ((Any?, Error?) -> ())?) method that call the first completionHandler with nil params.

Regards.

jordancamara commented 7 years ago

hi FouZ. Yes I believe this is a feature. This code was based on DyKnow's SignalRObjC library and in both cases, nil was intended to be passed into the completion handler