Manage friendships between users in your app, knowing when they gets online and offline
Friends Manager for your application, will manage relationships between userids and a socketid, which could b-e used with Socket.io to manage the online and offline friends in real time.
npm install friendship --save-dev
var Friendship = require'friendship';var friendship =expire: 3000 //auto checkouts in 3 seconds;
friendshipregister'uid1' 'uid2' 'uid3' 'uid4';
After the expire time (set on initialization), this socket will do a checkout
.check() is run before it.
Can also run a checkout of all sockets that it could have:
This will run a checkout of all sockets and remove the user from any relationship. Can be used to make the user to an offline state on every socket.
- Add option to use Redis store.
- A way to clear all.
- Fork this repo
- Create the tests for the new functionality or bug case
- Put your awesome code
- All good?, place a pull request