You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
--config.session.timeout等于 60秒
local wb, err = server:new{ timeout = config.session.timeout, -- in milliseconds
max_payload_len = 65535,
}
if not wb then
ngx.log(ngx.ERR, "failed to new websocket: ", err)
return ngx.exit(444)
end
wb:set_timeout(config.session.timeout)
while true do
local data, typ, err = wb:recv_frame()
if wb.fatal then
--ngx.log(ngx.ERR, "failed to receive frame: ", err)
break
end
if not data and not typ then
ngx.log(ngx.INFO,"------------------------"..tostring(data)..","..tostring(typ)..","..tostring(err))
break
end
if not data then
local bytes, err = wb:send_ping()
if not bytes then
ngx.log(ngx.ERR, "failed to send ping: ", err)
end
elseif typ == "close" then
break
elseif typ == "ping" then
ngx.log(ngx.INFO,"------------rec ping:send pong")
local bytes, err = wb:send_pong()
if not bytes then
ngx.log(ngx.ERR, "failed to send pong: ", err)
break
end
elseif typ == "pong" then
ngx.log(ngx.INFO,"------------rec pong")
elseif typ == "text" then
ngx.log(ngx.INFO,"receive: "..tostring(data))
local res = resolve.doresolve(M,data)
if res then
--log.err("----------response:"..tostring(res)..",req:"..tostring(data))
if dosend(res)==0 then
break
end
end
end
end
The text was updated successfully, but these errors were encountered:
--config.session.timeout等于 60秒
local wb, err = server:new{ timeout = config.session.timeout, -- in milliseconds
max_payload_len = 65535,
}
if not wb then
ngx.log(ngx.ERR, "failed to new websocket: ", err)
return ngx.exit(444)
end
wb:set_timeout(config.session.timeout)
while true do
local data, typ, err = wb:recv_frame()
if wb.fatal then
--ngx.log(ngx.ERR, "failed to receive frame: ", err)
break
end
if not data and not typ then
ngx.log(ngx.INFO,"------------------------"..tostring(data)..","..tostring(typ)..","..tostring(err))
break
end
if not data then
local bytes, err = wb:send_ping()
if not bytes then
ngx.log(ngx.ERR, "failed to send ping: ", err)
end
elseif typ == "close" then
break
elseif typ == "ping" then
ngx.log(ngx.INFO,"------------rec ping:send pong")
local bytes, err = wb:send_pong()
if not bytes then
ngx.log(ngx.ERR, "failed to send pong: ", err)
break
end
elseif typ == "pong" then
ngx.log(ngx.INFO,"------------rec pong")
elseif typ == "text" then
ngx.log(ngx.INFO,"receive: "..tostring(data))
local res = resolve.doresolve(M,data)
if res then
--log.err("----------response:"..tostring(res)..",req:"..tostring(data))
if dosend(res)==0 then
break
end
end
end
end
The text was updated successfully, but these errors were encountered: