while true do
local data, typ, err = wb:recv_frame()
if typ == "text" then
ngx.log(ngx.ERR,data);
elseif not data then
local bytes, err = wb:send_ping()
if not bytes then
---ngx.log(ngx.ERR, "failed to send ping: ", err)
return ngx.exit(444)
end
elseif typ == "pong" then
ngx.log(ngx.ERR,"ponged");
elseif typ == "close" then
break
end
end
还是隔10秒报一次time out错误,我的理解是否在wb:recv_frame()此处会有个timeout时间的等待,在10秒后无数据上报则返回timeout 错误。
2017/04/11 22:25:50 [error] 1485#0: *10 lua tcp socket read timed out, client: 192.168.1.17, server: localhost, request: "GET /sredis HTTP/1.1", host: "192.168.1.200"
2017/04/11 22:25:50 [error] 1485#0: *10 [lua] ws_redis_test.lua:83: ponged, client: 192.168.1.17, server: localhost, request: "GET /sredis HTTP/1.1", host: "192.168.1.200"
2017/04/11 22:26:00 [error] 1485#0: *10 lua tcp socket read timed out, client: 192.168.1.17, server: localhost, request: "GET /sredis HTTP/1.1", host: "192.168.1.200"
2017/04/11 22:26:00 [error] 1485#0: *10 [lua] ws_redis_test.lua:83: ponged, client: 192.168.1.17, server: localhost, request: "GET /sredis HTTP/1.1", host: "192.168.1.200"
2017/04/11 22:26:10 [error] 1485#0: *10 lua tcp socket read timed out, client: 192.168.1.17, server: localhost, request: "GET /sredis HTTP/1.1", host: "192.168.1.200"
2017/04/11 22:26:10 [error] 1485#0: *10 [lua] ws_redis_test.lua:83: ponged, client: 192.168.1.17, server: localhost, request: "GET /sredis HTTP/1.1", host: "192.168.1.200"
2017/04/11 22:26:20 [error] 1485#0: *10 lua tcp socket read timed out, client: 192.168.1.17, server: localhost, request: "GET /sredis HTTP/1.1", host: "192.168.1.200"
2017/04/11 22:26:20 [error] 1485#0: *10 [lua] ws_redis_test.lua:83: ponged, client: 192.168.1.17, server: localhost, request: "GET /sredis HTTP/1.1", host: "192.168.1.200"