Add more connection callbacks and a connected variable to represent connection status.
Merge branch 'master' of https://github.com/darkwallet/gateway