Node fbgraph module: will it work well with a large number of users?

I want to integrate facebook API into my NodeJS server. Right now , the fbgraph module looks like a simple and easy solution to my needs. My only concern is how fbgraph sets accessTokens for facebook users. According to the api description, accessToken is set as follows:

graph.setAccessToken(access_token); 

My only concern is this: if my site is gaining more popularity and I have hundreds of requests for a facebook schedule per second, I will have to set a global variable (what seems) for each user that I want to interact with. Is there a chance that an access token for the user can be set on the api chart before the previous user api request is processed? Intuitively, I feel like I should use a module that includes an access token with every API call, but maybe this is not necessary ...

Can someone clarify if my concerns are justified?

Best
Sami

+4
source share
1 answer

This is an actual issue, and actually there was a problem raised about this :

criso comment :

Doh! good point of view. I think this should probably be added as middleware so that the request is always associated with the session. Not sure when I can implement this. If you have time, go nuts!

then

criso comment :

Actually, instead:

 graph.get("/me", req.session.access_token, function(err, data) { console.log(data); }); 

Just do:

 graph .setAccessToken(req.session.access_token) .get("/me", function(err, data) { console.log(data); }); 
+3
source

All Articles