jpsim/CardsAgainst

Re-connect peers after leaving app

coopersita opened this issue · 4 comments

I know this is probably an underlying issue with the MPC framework, but I was wondering if there is a way in which users that leave the game (check email, answer a text or phone call), and then come back can be re-connected.

This definitely sounds like more of a bug in CardsAgainst rather than MPC. Feel free to file a PR if you can fix this.

I was just looking at this issue with some code I found on the web. When the user logs off, and reopens, a new instance of the MPC is created and so essentially there's a memory leak because the old instance doesn't release automatically. Apple gives a workaround at 32:00 in this video:
https://developer.apple.com/videos/play/wwdc2014/709/. There might have been more on this in other videos too from wwdc2013.

Basically, if you persist the data like the PeerID using NSKeyedArchiver, you can have the app remember who it lost a connection to so that you're not constantly re-instantiating new MPC channels. Was going to eventually add this to some code I found by Ralph Ebert on MPCs.

Hey @jpsim has this bug been fixed? I wanna take a crack at doing @ryan2clw recommendation

jpsim commented

I don't think anything's been done regarding this. If you can reproduce an issue, then you're in an ideal place to improve it!