标签:line div close frame 参考 hub websocket UI cal
local server =require"resty.websocket.server"
local wb, err = server:new{
timeout =5000,
max_payload_len =65535
}
ifnot wb then
ngx.log(ngx.ERR,"failed to new websocket: ", err)
return ngx.exit(444)
end
whiletruedo
local data, typ, err = wb:recv_frame()
if wb.fatal then
ngx.log(ngx.ERR,"failed to receive frame: ", err)
return ngx.exit(444)
end
if typ =="close"thenbreak
elseif typ =="text"then
local bytes, err = wb:send_text(data)
ifnot bytes then
ngx.log(ngx.ERR,"failed to send text: ", err)
return ngx.exit(444)
end
end
end
wb:send_close()
标签:line div close frame 参考 hub websocket UI cal
原文地址:http://www.cnblogs.com/rongfengliang/p/6661662.html