UNPKG

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

36 lines (29 loc) 879 B
var ConnectionService = require('../common/service/connectionService'); /** * Connection component for statistics connection status of frontend servers */ module.exports = function(app) { return new Component(app); }; var Component = function(app) { this.app = app; this.service = new ConnectionService(app); // proxy the service methods except the lifecycle interfaces of component var method, self = this; var getFun = function(m) { return (function() { return function() { return self.service[m].apply(self.service, arguments); }; })(); }; for(var m in this.service) { if(m !== 'start' && m !== 'stop') { method = this.service[m]; if(typeof method === 'function') { this[m] = getFun(m); } } } }; Component.prototype.name = '__connection__';