Comments (5)
Thanks, glad to hear it's useful!
I don't think this package will work on the server, since Deps is only
defined client-side.
What I'd recommend to get the server to do something when a user logs in
would be to have the client call a server-side method like so:
// client
EventHorizon.on('loggedIn',function(){ Meteor.call('onLogin'); });
// server
Meteor.methods({
onLogin: function() {
console.log('user logged in: '+this.userId);
}
});
Would that work?
On Thu, Mar 21, 2013 at 12:46 AM, Tarangp [email protected] wrote:
Wonderful package @belisarius222 https://github.com/belisarius222!! I
particularly find good use with the loggedIn event. I had to previously
write an adequately long check.Is it possible to have this loggedIn/loggedOut event on the server?
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/1
.
from meteor-event-horizon.
I'm using that at the moment, the trouble is the logout method. I can't use accounts-ui without modifying it because I have to employ a callback from Meteor.call to logout on the client. If I Meteor.call after logging out meteor won't be able to tell which user it was
from meteor-event-horizon.
Hmm, you could maybe store the userId in a variable while logged in, like
Meteor.previousUserId or something, and then when you get a loggedOut event
on the client, run Meteor.call('onLogout',Meteor.previousUserId);
Not sure about the security implications of that approach.
On Thu, Mar 21, 2013 at 9:52 PM, Tarangp [email protected] wrote:
I'm using that at the moment, the trouble is the logout method. I can't
use accounts-ui without modifying it because I have to employ a callback
from Meteor.call to logout on the client. If I Meteor.call after logging
out meteor won't be able to tell which user it was—
Reply to this email directly or view it on GitHubhttps://github.com//issues/1#issuecomment-15281198
.
from meteor-event-horizon.
Ah I see now. That is how I am making the call to the server. I wonder if it's possible to make EventHorizon work on server side as well?
It would be nice to have some sort of interface between the two that is hidden to the developer's eyes. But I guess this is not necessary as Meteor.call() is essentially same. The beauty of this would be you wouldn't have to have to expose all the Meteor.methods.
client.js
EventHorizon.fire{'loggedin'}
server/events.js
EventHorizon.on{'loggedIn', handleUser};
from meteor-event-horizon.
@belisarius222 this is tricky because I would be able to trick the onLogOut method on the server with a random userId & not be able to verify its legitimate so it poses a bit of a security risk. I have meteor connecting to facebook's xmpp servers & I want to be able to tell them to log out, for now I'm using a callback & waiting to disconnect first.
from meteor-event-horizon.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from meteor-event-horizon.