pomelo
Version:
Pomelo is a fast, scalable game server framework for [node.js](http://nodejs.org). It provides the basic development framework and many related components, including libraries and tools. Pomelo is also suitable for real-time web applications; its distri
52 lines (47 loc) • 1.3 kB
JavaScript
module.exports = function(app) {
return new Handler(app);
};
var Handler = function(app) {
this.app = app;
};
/**
* New client entry.
*
* @param {Object} msg request message
* @param {Object} session current session object
* @param {Function} next next step callback
* @return {Void}
*/
Handler.prototype.entry = function(msg, session, next) {
next(null, {code: 200, msg: 'game server is ok.'});
};
/**
* Publish route for mqtt connector.
*
* @param {Object} msg request message
* @param {Object} session current session object
* @param {Function} next next step callback
* @return {Void}
*/
Handler.prototype.publish = function(msg, session, next) {
var result = {
topic: 'publish',
payload: JSON.stringify({code: 200, msg: 'publish message is ok.'})
};
next(null, result);
};
/**
* Subscribe route for mqtt connector.
*
* @param {Object} msg request message
* @param {Object} session current session object
* @param {Function} next next step callback
* @return {Void}
*/
Handler.prototype.subscribe = function(msg, session, next) {
var result = {
topic: 'subscribe',
payload: JSON.stringify({code: 200, msg: 'subscribe message is ok.'})
};
next(null, result);
};