吕君喜 406d880ac6 first | %!s(int64=3) %!d(string=hai) anos | |
---|---|---|
.. | ||
lib | %!s(int64=3) %!d(string=hai) anos | |
node_modules | %!s(int64=3) %!d(string=hai) anos | |
.gitignore | %!s(int64=3) %!d(string=hai) anos | |
LICENSE | %!s(int64=3) %!d(string=hai) anos | |
README.md | %!s(int64=3) %!d(string=hai) anos | |
index.js | %!s(int64=3) %!d(string=hai) anos | |
package.json | %!s(int64=3) %!d(string=hai) anos |
pomelo-status-plugin is a plugin for pomelo, it can be used in pomelo(>=0.6).
pomelo-status-plugin provides global status service for pomelo, which uses persistent storage to save users information.
##Installation
npm install pomelo-status-plugin
##Usage
var status = require('pomelo-status-plugin');
app.use(status, {status: {
host: '127.0.0.1',
port: 6379
}});
##API
###getSidsByUid(uid, cb) get frontend server id by user id ####Arguments
####Return
###getStatusByUid(uid, cb) ####Arguments
####Return
###getStatusByUids(uids, cb) ####Arguments
####Return
###pushByUids(uids, route, msg, cb) ####Arguments
####Return
##Notice
status plugin use redis as a default persistent storage, you can change it with your own implementation.
var status = require('pomelo-status-plugin');
var mysqlStatusManager = require('./mysqlStatusManager');
app.use(status, {status: {
host: '127.0.0.1',
port: 6379,
channelManager: mysqlStatusManager
}});
in >=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.
app.use(status, {status: {
host: '127.0.0.1',
port: 6379,
cleanOnStartUp: true
}});