I’m using @spencercarli’s awesome https://github.com/spencercarli/node-ddp-client package, and there’s one glaring issue: when you’re server goes down, like whenever you change some server code, the React Native client needs to login again before making any requests that require a
userId on the server.
The package is still pretty young–but has been very useful. I’d like to figure out what the standard Meteor browser client does for this situation to add it to the React native node ddp client package we’re using. The Meteor browser client must either detect the disconnection and after reconnection make another request to log you in with your token (which also seems incorrect), or it must somehow remember better.
If you look in the code of node-ddp-client you will see there it doesn’t store the login token. I’m actually using @spencercarli’s React Native Meteor Boilerplate package: https://github.com/spencercarli/react-native-meteor-boilerplate which adds additional code specific to React Native to store the login token in
AsyncStorage. What I’m thinking is the ddp client for standard browser-based Meteor apps must store this token or perhaps another type of token so that it can continue to make requests to the server when it comes back on. Because the way this seems to be working is that it logs you in with your token and then opens a websocket connection, and then that websocket connection must simply stay open. There is no state–i.e. a token–maintained on both the server and client that stay alive through temporary outages. The login token I mentioned before seems to be used simply to initiate the connection, but then once the connection occurs, it’s on its own. So there must be something missing that the browser client uses to overcome these situations. Perhaps it’s as simple as detecting a disconnect and re-logging you in with a token, and therefore re-opening the websocket connection. If that’s the case, does anyone have an idea where the standard browser code that does this is?
Any tips–however small–would be much appreciated.