-
Notifications
You must be signed in to change notification settings - Fork 183
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
WebSocket: Close #195
Comments
I submitted a PR ( #197 ) that would make this issue moot 🙏 |
I'm not in favour of switching to a different implementation without understanding the root cause.
The function Base.close(ws::WebSocket)
if !ws.txclosed
closewrite(ws)
end
while !ws.rxclosed
readframe(ws)
end
close(ws.io)
end
That's fine. It just means that users should not write anything to the socket after they call
So users should call Base.eof(ws::WebSocket) = ws.rxclosed || eof(ws.io) That way users could do: while !eof(ws) # ws.rxclosed checked here
x = readavailable(ws) # ws.rxclosed set here when close frame is recieved
end
close(ws) # close frame is sent here when close calls closewrite
This is missing (see note above about adding |
I've merged your tests into this commit: 2cea2f7 |
👍 |
HI,
I'm struggling a little bit with
closewrite
. If I understand, it is kind of a "partial" close that toggles thetxclosed
indicator, sends aCLOSE
opcode, but leaves the underlying socket open. However, if I look at the WebSockets spec:https://tools.ietf.org/html/rfc6455#section-5.5.1
Does this mean we should NOT have a
closewrite
for WebSockets? If aCLOSE
opcode is sent, we should not be sending any addition data over the websocket.I'm playing around with a branch that uses
ReadyState
borrowed from the original WebSockets.jl package sotxclosed
becomestxstate
andrxclosed
becomesrxstate
, but given the above, I am wondering if we need to keep track oftx
andrx
states, Maybe it should just be a singlestate
.What do you think?
The text was updated successfully, but these errors were encountered: