Skip to content

Commit

Permalink
Merge pull request #86 from soramitsu/FLW-2976-Stop-processes-after-a…
Browse files Browse the repository at this point in the history
…-long-time-of-use

FLW-2976: Connect and disconnect logic
  • Loading branch information
DRadmir authored Jan 31, 2023
2 parents d0ff4ee + 045587e commit c9f1fd7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
5 changes: 4 additions & 1 deletion FearlessUtils/Classes/Network/JSONRPCEngine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public final class JSONRPCSubscription<T: Decodable>: JSONRPCSubscribing {
}

public protocol JSONRPCEngine: AnyObject {
var url: URL? { get set }
var pendingEngineRequests: [JSONRPCRequest] { get }

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

func generateRequestId() -> UInt16
func addSubscription(_ subscription: JSONRPCSubscribing)
func connect(with pendingRequests: [JSONRPCRequest])
func reconnect(url: URL)

func connectIfNeeded()
func disconnectIfNeeded()
}

public extension JSONRPCEngine {
Expand Down
6 changes: 0 additions & 6 deletions FearlessUtils/Classes/Network/WebSocketEngine+Protocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,6 @@ extension WebSocketEngine: JSONRPCEngine {
mutex.unlock()
}

public func connect(with pendingRequests: [JSONRPCRequest]) {
pendingRequests.forEach {
updateConnectionForRequest($0)
}
}

public func reconnect(url: URL) {
self.connection.delegate = nil

Expand Down

0 comments on commit c9f1fd7

Please sign in to comment.