NetEase / pomelo-cn

The Chinese issues for pomelo.
38 stars 13 forks source link

客户端无操作,大概1分钟后会自动断开session,哪里设置这个时间? #263

Open splendone opened 9 years ago

splendone commented 9 years ago

客户端连接服务器之后,无操作,大概1分钟后服务器会打印以下log,客户端断开连接 session on [connector-server-1] is closed with session id: 1

请问哪里配置这个自动断连接的时间?

py8765 commented 9 years ago

使用的哪种connector

splendone commented 9 years ago

用的hybridconnector

py8765 commented 9 years ago

timeout参数 默认是90s

splendone commented 9 years ago

这个时间在哪里设置的?

py8765 commented 9 years ago

connector的opts参数中设置,具体可以参考一下lib/connector/hybrid/switcher.js

splendone commented 9 years ago

lib/connector/hybrid/switcher.js======================== var DEFAULT_TIMEOUT = 300;

/**

app.js================== app.configure('production|development', 'connector', function(){ app.set('connectorConfig', { connector : pomelo.connectors.hybridconnector, heartbeat : 30, timeout: 300, useDict : true, useProtobuf : true });

修改如上,但是好像还是很快就断开了………………

py8765 commented 9 years ago

服务端有什么报错提示?

splendone commented 9 years ago

没有报错,就是启动之后等1分钟多就session closed,log如下:

[2015-11-03 01:56:06.420] [DEBUG] pomelo - [/home/ubuntu/workspace/test/game-server/node_modules/pomelo/lib/common/service/sessionService.js] session on [connector-server-1] is closed with session id: 1

thugasin commented 8 years ago

我也遇到了这样的问题,问下是怎样解决的?

我是在客户端待机的时候,服务器session close,问下我应该如何重新建立连接?

splendone commented 8 years ago

前端频繁的发心跳包可以保持连接不断,是修改前端的,服务器没改动

StubbornSlug commented 7 years ago

我碰到的问题是 客户端一挂起立马断开链接,比如断点调试,手机黑屏待机,不晓得怎么解决这个问题