-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Pomelo's new features in version 0.6
Pomelo 0.6 imports a new structure called plugin, and we make globalChannel and zookeeper as plugins for pomelo. Meanwhile, we provide a new interactive command-line tool which is more convenient to do some maintaining operations than before. In addition, in order to enhance pomelo's safety, in pomelo 0.6 we import data signature and deal with illegal connections for hybridconnector. Other features include more detailed rpc log , max connections for frontend server, servers reconnect after disconnecting from master and pomelo-daemon.
In order to give more convenience for developers to improve pomelo according to different custom demands, we creates plugin for pomelo. The detail information can refer to plugin.
In pomelo 0.6, we provide data signature for hybridconnector. Firstly, the client generates rsa key pair and it would keep the private key; then the server would get the public key during the handshake phrase; thirdly, the client would send the message and the signature which is signed by the private key in the client side to the server; finally, the server would verify the signature with the public key from the client. The detail flow is as follow chart:
client
javascript
pomelo.init({
host:'127.0.0.1',
port:3014,
encrypt:true
}, function() {
// do something connected
});
server
```javascript```
app.set('connectorConfig', {
connector: pomelo.connectors.hybridconnector,
heartbeat: 3,
useDict: true,
useProtobuf: true,
useCrypto: true
});
In pomelo sioconnector is based on socket.io, and socket.io itself has dealt with illegal connections. For hybridconnector is based on socket which does not do anything about illegal connections, we have dealt with this problem in pomelo 0.6, including empty connections and connections which do not meet with pomelo protocol standard.
According to pomelo developers' suggestion, we add more logs in pomelo-rpc. Developers only need to add app.enable('rpcDebugLog') in app.js, and modify game-server/config/servers.json as follow code:
json
{
"type": "file",
"filename": "./logs/rpc-debug-${opts:serverId}.log",
"fileSize": 1048576,
"layout": {
"type": "basic"
}
"backups":5,
"category": "rpc-debug"
}
## Overload protection
We have toobusy module to protect servers from overload in pomelo, and in new edition we add a feature to limit the max connections of frontend server. When the frontend server's connections exceed the max connections, it would refuse new connections. The configure code is as follow:
```json```
{"id":"connector-server-1", "host":"127.0.0.1", "port":4050, "clientPort":3050, "frontend":true, "max-connections": 100}
In distributed environment, there exists situations that servers(not master) disconnect from intranet. When the server recovers from disconnecting, it would also has problems for the whole system. So we have solved this problem in pomelo 0.6.
