Skip to content

Instantly share code, notes, and snippets.

@awatson1978
Created August 27, 2015 16:30
Show Gist options
  • Save awatson1978/58c8c516636b419684ae to your computer and use it in GitHub Desktop.
Save awatson1978/58c8c516636b419684ae to your computer and use it in GitHub Desktop.
Client Only Apps
let remote = DDP.connect(Meteor.settings.public.remote.url);
Meteor.connection = remote;
Accounts.connection = remote;
Meteor.users = new Mongo.Collection('users', remote);
Orders = new Mongo.Collection('orders', remote);
FlowRouter.subscriptions = function () {
this.register('workstation', Meteor.settings.remote.id);
}
// handle the reconnect annoyances
if (Meteor.isClient) {
Accounts.onLogin(function () {
Meteor._localStorage.setItem('_token', Accounts._storedLoginToken());
});
remote.onReconnect = function () {
Meteor.loginWithToken(Meteor._localStorage.getItem('_token'));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment