-
Notifications
You must be signed in to change notification settings - Fork 114
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
sync client and settimeout() #80
Comments
After some debugging seems that local clean = function(was_clean,code,reason)
if reason ~= 'timeout' then
self.state = 'CLOSED'
self:sock_close()
if self.on_close then
self:on_close()
end
end
return nil,nil,was_clean,code,reason or 'closed'
end PS. not sure if that won't cause problem if a timeout happens after the first |
@EnTerr Added this as feature request. It's not that trivial, as you must think of partially received messages/frames. |
great. i'll keep this issue open, until ws:receive() accepts an optional timeout |
Ok, so here is a more complete fix i came up with, most code is round about https://github.com/lipp/lua-websockets/blob/master/src/websocket/sync.lua#L24
So every time In addition, |
nice! can you make a PR from this? |
Oops, afraid i can't. I don't have the code under git - besides i am working on almost a year old lua-websockets version, under svn. I did skim the /master/src/websocket/sync.lua here and there are no substantial/relevant changes - but i am nor really set up to PR. Maybe if one day i get current i will |
I am using the sync client, receiving about 30 msgs/sec. I don't want to get stuck waiting if there is no data ready, so i am trying this:
My idea/hope being that if there is no data available, it will fail and return me nil or some such and then i will do my other job and keep polling from time to time till i get something. I get nil - HOWEVER it also seems to close the connection, so i never really receive anything!
From my point of view seems like a bug. What can i do?
The text was updated successfully, but these errors were encountered: