trustwallet / wallet-connect-swift

WalletConnect Swift client SDK
MIT License
116 stars 131 forks source link

An ”sessionRequestTimeout“ exception was thrown when attempting to connect to an approved session #38

Open andybin-cdc opened 4 years ago

andybin-cdc commented 4 years ago

When attempting to connect to an approved session, the server will never send the "wc_sessionRequest" method. But the "sessionTimer" is still running, and Eventually I'll get a "sessionRequestTimeout" exception. WCInteractor.swift#L235

hewigovens commented 4 years ago

You have to invalidate that timer in your code

andybin-cdc commented 4 years ago

@hewigovens Thank you for your reply, but the "sessionTimer" is private. WCInteractor.swift#L47

hewigovens commented 4 years ago

oh, I forget to mention WCSessionStore.store, timer will be ignored for existing session: https://github.com/trustwallet/wallet-connect-swift/blob/master/WalletConnect/WCInteractor.swift#L227

andybin-cdc commented 4 years ago

@hewigovens Thank you for your help! I resolved my problem. I store the session into the WCSessionStore, before every time connect to the Approved Session.

andybin-cdc commented 4 years ago

Hi, @hewigovens, I wanna use WCSessionStore to manager my sessions, but when WCInteractor disconnect or deinit the session will be remove from WCSessionStore WCInteractor.swift#L109, I think this behavior is a little confusing.

maybe it makes more sense to remove sessions in "killSession"? WCInteractor.swift#L135 or just let the user decide when to remove from WCSessionStore, Because this is added to the WCSessionStore by user.