-
-
Notifications
You must be signed in to change notification settings - Fork 37
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
Add WebSocketHandler
helper for websocket-based FrontendConnection extensions
#247
Conversation
@SimonDanisch Could you please approve my workflows? :o) |
I think the CI is timing out, but it does not appear to obviously be related to the content of the PR. Looks like the documentation preview wasn't built because the PR is from a fork. |
It does seem to be related?
|
Ah. Looks like I pushed a slightly different version from the one I had manually tested. For some reason. I have trouble running the tests locally (they seem to pop up a few windows and then freeze indefinitely). As for the CI, when I inspect the output it looks like it's timed out after 6 hours and all of the output after the first 50 lines (featuring package installs) is blank so I don't see the error you pasted. |
I'll wait to see how #248 gets fixed and then rebase + try to fix this. |
Figured out the problem -- it was rather simple and but not fully obvious due to exceptions not printing in sub threads -- it should work now. I was able to run the tests locally using Can still hold off until #251 if you like |
I did run into this as well... Not really clear why though -.- I suspect |
src/connection/websocket-handler.jl
Outdated
function run_connection_loop(session::Session, handler::WebSocketHandler, websocket::WebSocket) | ||
@debug("opening ws connection for session: $(session.id)") | ||
handler.socket = websocket | ||
while !isclosed(websocket) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be isopen(handler)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is copied from
Bonito.jl/src/connection/websocket.jl
Line 95 in 1964ec0
while !isclosed(websocket) |
The reference for the method is here https://juliaweb.github.io/HTTP.jl/stable/reference/#HTTP.WebSockets.isclosed
Do you mean Base.isopen? Is it the opposite?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I just realized I have these comments in our isopen
implementation:
Bonito.jl/src/connection/websocket-handler.jl
Lines 45 to 56 in 3175f80
function Base.isopen(ws::WebSocketHandler) | |
isnothing(ws.socket) && return false | |
# isclosed(ws.socket) returns readclosed && writeclosed | |
# but we consider it closed if either is closed? | |
if ws.socket.readclosed || ws.socket.writeclosed | |
return false | |
end | |
# So, it turns out, ws connection where the tab gets closed | |
# stay open indefinitely, but aren't writable anymore | |
# TODO, figure out how to check for that | |
return true | |
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay done since it seems fine to change then. It should just mean we get rid of half-closed sockets quicker I suppose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that's what I hope :) Although, the web does keep surprising me!
Thank you :) |
Previously outlined here: #244