mardi 27 mai 2014

socket.io and sails js issue accessing get request query string


Vote count:

0




I am sorry if this question has been asked before in the forum but I am not able to find what I am looking for. I am looking to develop a notification mechanism in my sails js app.


Taking the analogy of facebook, lets say we have users and pages.


Users can follow other users


Users can like a page


If a user A is following user B, then user A must get notifications from User B's activity. For example, if user B likes a page, User a must be notified.


I saw this tutorial for sockets.io which was quite helpful to get me started. The thing is that in this tutorial, the person is subscribing only to the User collection. If anything changes in that collection for the specified user, then the subscriber is notified. I want to selectively subscribe to a particular user


For this, I was trying to provide a query string with socket.get request


For example



socket.get('/user/subscribe?followee=2');


The problem I am running into is that when I try to access the query string in the controller, I don't see the followee param or any other param.



sails.log.debug(req.params.all());


shows an empty object.



asked 18 secs ago






Aucun commentaire:

Enregistrer un commentaire