We are using MDWamp for a mobile dev project involving the use of WAMP over websockets (using crossbar.io as a WAMP router). We're wondering what is the most appropriate approach to dealing with app lifecycle and the WAMP connection. Should we be closing the websocket anytime the app cedes control to iOS or another app?
It makes sense to close the connection while your app is idle if you don't need it for constant background updates like geolocation and similar stuff. However! It'll be smart to consider this type of disconnection as a short-term-disconnection, so you can implement a reconnection mechanism which is more efficient than a regular one.
So, for example, if every new client requires DB access to authenticate, implement your own custom WAMP RPC call that will announce that this is only a short-term disconnection. When you know that the disconnecting session can come back shortly, you keep its user details in cache, so next time it connects and authenticates, you don't need to access the DB all over again.
TL;DR - You should disconnect, but do it wisely.