https://github.com/topfreegames/pernilongo
A pomelo plugin that talks to mongo for registering, authorizing and unauthorizing users in rooms/topics of a mosquitto server
https://github.com/topfreegames/pernilongo
Last synced: 7 months ago
JSON representation
A pomelo plugin that talks to mongo for registering, authorizing and unauthorizing users in rooms/topics of a mosquitto server
- Host: GitHub
- URL: https://github.com/topfreegames/pernilongo
- Owner: topfreegames
- License: mit
- Created: 2016-07-05T21:51:44.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-03-03T21:24:14.000Z (over 2 years ago)
- Last Synced: 2025-02-19T11:05:00.918Z (8 months ago)
- Language: JavaScript
- Homepage:
- Size: 45.9 KB
- Stars: 0
- Watchers: 9
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Pernilongo
==========[](https://travis-ci.org/topfreegames/pernilongo)
### Example Usage
Make pomelo use the component:
```
var pernilongo = require('pernilongo-plugin')...
...app.configure('production|development', 'connector', function(){
app.set('connectorConfig',
...
...
app.use(pernilongo, {
pernilongo: {
redisUrl: "//localhost:6379"
}
})
...
...
})
```Then use the component like:
```
var Handler = function(app) {
...
this.pernilongo = this.app.get('pernilongo')
}Handler.prototype.registerPlayer = function(msg, session, next) {
logger.debug('registering player ' + msg.user)
this.pernilongo.registerPlayer(msg.user, msg.pass).then( res => {
return next(null, 'player registered!')
}).catch(e => {
return next(new Error('failed to register player'))
})
}```