Skip to content

Commit c9f1fd7

Browse files
authored
Merge pull request #86 from soramitsu/FLW-2976-Stop-processes-after-a-long-time-of-use
FLW-2976: Connect and disconnect logic
2 parents d0ff4ee + 045587e commit c9f1fd7

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

FearlessUtils/Classes/Network/JSONRPCEngine.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ public final class JSONRPCSubscription<T: Decodable>: JSONRPCSubscribing {
9595
}
9696

9797
public protocol JSONRPCEngine: AnyObject {
98+
var url: URL? { get set }
9899
var pendingEngineRequests: [JSONRPCRequest] { get }
99100

100101
func callMethod<P: Encodable, T: Decodable>(
@@ -116,8 +117,10 @@ public protocol JSONRPCEngine: AnyObject {
116117

117118
func generateRequestId() -> UInt16
118119
func addSubscription(_ subscription: JSONRPCSubscribing)
119-
func connect(with pendingRequests: [JSONRPCRequest])
120120
func reconnect(url: URL)
121+
122+
func connectIfNeeded()
123+
func disconnectIfNeeded()
121124
}
122125

123126
public extension JSONRPCEngine {

FearlessUtils/Classes/Network/WebSocketEngine+Protocol.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,6 @@ extension WebSocketEngine: JSONRPCEngine {
7474
mutex.unlock()
7575
}
7676

77-
public func connect(with pendingRequests: [JSONRPCRequest]) {
78-
pendingRequests.forEach {
79-
updateConnectionForRequest($0)
80-
}
81-
}
82-
8377
public func reconnect(url: URL) {
8478
self.connection.delegate = nil
8579

0 commit comments

Comments
 (0)