initial commit of poker game

This commit is contained in:
Edward Yang
2015-03-20 14:21:44 -07:00
commit cd7f17778f
147 changed files with 10833 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
var dispatcher = require('../../../util/dispatcher');
module.exports = function(app){
return new Handler(app);
};
var Handler = function(app){
this.app = app;
};
var handler = Handler.prototype;
/**
* Gate handler that dispatch user to connectors.
*
* @param {Object} msg message from client
* @param {Object} session
* @param {Function} next next stemp callback
*
*/
handler.queryEntry = function(msg, session, next){
// get all connectors
var connectors = this.app.getServersByType('connector');
if(!connectors || connectors.length === 0){
next(null, {
code : 500
});
return;
}
// select connector
var res = dispatcher.dispatch(1, connectors);
next(null, {
code : 200,
host : res.host,
port : res.clientPort
});
};