Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Http链接重复利用给websocket时的错误 #39

Open
bazhi opened this issue Dec 8, 2018 · 1 comment
Open

Http链接重复利用给websocket时的错误 #39

bazhi opened this issue Dec 8, 2018 · 1 comment

Comments

@bazhi
Copy link

bazhi commented Dec 8, 2018

websocekt/client.lua

local count, err = sock:getreusedtimes()
if not count then
return nil, "failed to get reused times: " .. err
end
if count > 0 then
-- being a reused connection (must have done handshake)
return 1
end

-- do the websocket handshake:

当一个http链接关闭之后,如果这个http链接,被websocket链接从链接池里面取出来时,则这个链接的reusedtimes时大于0的,然后这个链接不会被handshake。

@agentzh
Copy link
Member

agentzh commented Feb 4, 2019

@bazhi Please, do not use Chinese here. This place is considered English only. If you really want to use Chinese, please join and post to the openresty (Chinese) mailing list instead. Please see https://openresty.org/en/community.html Thanks for your cooperation.

Regarding to your question, it is wrong to do repeated websocket handshakes on a connection that has already done websocket handshake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants