您的位置:首页 > Web前端

pomelo前端服务器配置解析

2015-12-18 16:56 507 查看
pomelo的服务器配置在项目中

config/servers.json中

[code]"development":{
"connector":[
{"id":"connector-server-1", "host":"127.0.0.1", "port":4050, "clientPort": 3050, "frontend": true},
{"id":"cs2", "host":"127.0.0.1", "port":4050, "clientPort": 3051, "frontend": true}
],
"chat":[
{"id":"chat-server-1", "host":"127.0.0.1", "port":6050}
],
"gate":[
{"id": "gate-server-1", "host": "127.0.0.1", "clientPort": 3014, "frontend": true}
]
  }


注意:带有

[code] "clientPort": 3050,  // 客户端连接时监听的端口
 "frontend": true,  // 前端服务器


的为前端服务器,这两个参数缺一不可。

为了使得客户端顺利的连接,在app.js的需要对所有的前端服务器进行协议设置

[code]app.configure('production|development', 'connector', function(){
  app.set('connectorConfig', // 注意,这里只能是这个'connectorConfig',其他值无效
    {
      connector : pomelo.connectors.hybridconnector,
      heartbeat : 3,
      useDict : true,
      useProtobuf : true
    });
});


希望童鞋们匆必要记信这些关键点,否则会出莫名奇妙的连接错误。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: