package.json 2.8 KB

123456789101112131415161718192021222324
  1. {
  2. "name": "pomelo-status-plugin",
  3. "version": "0.0.6",
  4. "private": false,
  5. "author": {
  6. "name": "py8765 pengyang633@126.com/@py8765"
  7. },
  8. "contributors": [
  9. {
  10. "name": "gitig"
  11. }
  12. ],
  13. "dependencies": {
  14. "redis": "2.6.0-2",
  15. "pomelo-logger": "0.1.2"
  16. },
  17. "readme": "pomelo-status-plugin\r\n====================\r\n\r\npomelo-status-plugin is a plugin for pomelo, it can be used in pomelo(>=0.6).\r\n\r\npomelo-status-plugin provides global status service for pomelo, which uses persistent storage to save users information.\r\n\r\n##Installation\r\n\r\n```\r\nnpm install pomelo-status-plugin\r\n```\r\n\r\n##Usage\r\n\r\n```\r\nvar status = require('pomelo-status-plugin');\r\n\r\napp.use(status, {status: {\r\n host: '127.0.0.1',\r\n port: 6379\r\n}});\r\n\r\n```\r\n\r\n##API\r\n\r\n###getSidsByUid(uid, cb)\r\nget frontend server id by user id\r\n####Arguments\r\n+ uid - user id\r\n+ cb - callback function\r\n\r\n####Return\r\n+ err - error\r\n+ list - array of frontend server ids\r\n\r\n###getStatusByUid(uid, cb)\r\n####Arguments\r\n+ uid - user id\r\n+ cb - callback function\r\n\r\n####Return\r\n+ err - error\r\n+ status - boolean, true if user is online (at least one session with a frontend) or false otherwise\r\n\r\n###getStatusByUids(uids, cb)\r\n####Arguments\r\n+ uids - array of user ids\r\n+ cb - callback function\r\n\r\n####Return\r\n+ err - error\r\n+ statuses - object with uid as keys and boolean as value, true if user is online (at least one session with a frontend) or false otherwise\r\n\r\n###pushByUids(uids, route, msg, cb)\r\n####Arguments\r\n+ uids - array of user ids\r\n+ route - route string\r\n+ msg - messages would be sent to clients\r\n+ cb - callback function\r\n\r\n####Return\r\n+ err - error\r\n+ fails - array of failed to send user ids\r\n\r\n##Notice\r\n\r\nstatus plugin use redis as a default persistent storage, you can change it with your own implementation. \r\n\r\n```\r\nvar status = require('pomelo-status-plugin');\r\nvar mysqlStatusManager = require('./mysqlStatusManager');\r\n\r\napp.use(status, {status: {\r\n host: '127.0.0.1',\r\n port: 6379,\r\n channelManager: mysqlStatusManager\r\n}});\r\n\r\n```\r\nin >=0.0.3 version add cleanOnStartUp option, when you enable this option, status plugin would clean up the old data with the given prefix string.\r\n\r\n```\r\napp.use(status, {status: {\r\n host: '127.0.0.1',\r\n port: 6379,\r\n cleanOnStartUp: true\r\n}});\r\n\r\n```\r\n",
  18. "readmeFilename": "README.md",
  19. "description": "pomelo-status-plugin\r ====================",
  20. "_id": "pomelo-status-plugin@0.0.6",
  21. "_shasum": "fa17e850278bb1a61a9e6d601b7d6db2a4847360",
  22. "_resolved": "git+https://github.com/feitianbubu/pomelo-status-plugin.git#8c3fcb15d1c16ec6b8011b061d6ecab2da6d0797",
  23. "_from": "pomelo-status-plugin@git+https://github.com/feitianbubu/pomelo-status-plugin.git"
  24. }