Skip to content

Commit cc46d55

Browse files
ChiragAgg5kCopilot
andauthored
Update templates/swift/Sources/Services/Realtime.swift.twig
Co-authored-by: Copilot <[email protected]>
1 parent ac43a8b commit cc46d55

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

templates/swift/Sources/Services/Realtime.swift.twig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ open class Realtime : Service {
2323
private var subscriptionsCounter = 0
2424
private var reconnect = true
2525

26-
private var onErrorCallback: ((Swift.Error?, HTTPResponseStatus?) -> Void)?
27-
private var onCloseCallback: (() -> Void)?
26+
private var onErrorCallbacks: [((Swift.Error?, HTTPResponseStatus?) -> Void)] = []
27+
private var onCloseCallbacks: [(() -> Void)] = []
2828

2929
public func onError(_ callback: @escaping (Swift.Error?, HTTPResponseStatus?) -> Void) {
30-
self.onErrorCallback = callback
30+
self.onErrorCallbacks.append(callback)
3131
}
3232

3333
public func onClose(_ callback: @escaping () -> Void) {
34-
self.onCloseCallback = callback
34+
self.onCloseCallbacks.append(callback)
3535
}
3636

3737
private func startHeartbeat() {

0 commit comments

Comments
 (0)