/////////////////////////////////////////////////// ////////////////////服务器心跳包/////////////////// /////////////////////////////////////////////////// var mod_heartbeat = mod_heartbeat || cls_mod.new("mod_heartbeat", "heartbeat", app_server); // mod_heartbeat.TCPList = []; //TCP客户端连接 // mod_heartbeat.OnTcpConnected = function(str_tcpid) // { // if (min_ary_indexof(mod_heartbeat.TCPList, str_tcpid) == -1) // { // if (str_tcpid){ // mod_heartbeat.TCPList.push(str_tcpid); // } // } // } //TCP客户端断开 // mod_heartbeat.OnTcpDisConnected = function(str_tcpid) // { // if (str_tcpid){ // min_ary_delval(mod_heartbeat.TCPList, str_tcpid); // } // } //发送心跳包 mod_heartbeat.doheartbeat = function() { if ((mod_heartbeat.app) && (mod_heartbeat.app.SendPack_Tcp)) { mod_heartbeat.app.SendPack_Tcp([-1], '{"com":"@serverheartbeat"}'); } } //开启定时器发送心跳包 min_ontime(mod_heartbeat.doheartbeat, 20000);