09-08-2011, 01:17 PM
The nice thing about the gateway protocol is that it's mostly stateless. In the iPhone environment, an app can keep running in the background forever, and the phone can go to sleep any time. This is difficult to deal with in the Riva client, but in the XML Gateway client it's not a problem. My plan had been to let the server disconnect me whenever it wanted to, disconnect myself whenever going into the background or going to sleep, and reconnect as needed. The user experience should be unaffected save for a brief pause to reconnect whenever new data is required. Unlike Riva, I don't really need a persistent connection for any reason. Further, we can't keep a connection alive forever when we go to sleep, and even when the phone is alive we wouldn't want to keep it alive without a good reason, because the app might be dormant in the background, not really needing the connection for anything. So I'd say the current state of the protocol is fine. The only question is whether an explicit disconnect message needs to be added so that the server doesn't think there's a problem. Or alternatively, we could just change the server so it doesn't think it's a problem for a client to disconnect without warning.