Skip to content

Commit 025e122

Browse files
psycotica0Michelle Ellis
authored andcommitted
Only Reconnect if autoReconnect
Forgot that this was configurable. I should honour that configuration.
1 parent ba29d4e commit 025e122

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

Source/PusherWebsocketDelegate.swift

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,18 @@ extension PusherConnection: WebSocketDelegate {
4040
channel.subscribed = false
4141
}
4242

43-
let operation = NSBlockOperation {
44-
self.socket.connect()
45-
}
43+
if let reconnect = self.options.autoReconnect where reconnect {
44+
let operation = NSBlockOperation {
45+
self.socket.connect()
46+
}
4647

47-
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(NSEC_PER_SEC)), dispatch_get_main_queue()) {
48-
NSOperationQueue.mainQueue().addOperation(operation)
49-
}
48+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(NSEC_PER_SEC)), dispatch_get_main_queue()) {
49+
NSOperationQueue.mainQueue().addOperation(operation)
50+
}
5051

51-
self.reconnectOperation?.cancel()
52-
self.reconnectOperation = operation
52+
self.reconnectOperation?.cancel()
53+
self.reconnectOperation = operation
54+
}
5355
}
5456

5557
public func websocketDidConnect(ws: WebSocket) {}

0 commit comments

Comments
 (0)