Created
August 27, 2015 16:30
-
-
Save awatson1978/58c8c516636b419684ae to your computer and use it in GitHub Desktop.
Client Only Apps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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