根据 chat 示例创建 game-server,支持分布式部署、域名访问、数据库连接和基础使用
This commit is contained in:
15
game-server/app/util/routeUtil.ts
Normal file
15
game-server/app/util/routeUtil.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
import { dispatch} from './dispatcher';
|
||||
import { Session, Application } from 'pinus';
|
||||
|
||||
export function chat(session: Session, msg: any, app: Application, cb: (err: Error , serverId ?: string) => void) {
|
||||
let chatServers = app.getServersByType('chat');
|
||||
|
||||
if(!chatServers || chatServers.length === 0) {
|
||||
cb(new Error('can not find chat servers.'));
|
||||
return;
|
||||
}
|
||||
|
||||
let res = dispatch(session.get('rid'), chatServers);
|
||||
cb(null, res.id);
|
||||
}
|
||||
Reference in New Issue
Block a user