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

webio_serve and @app doesn't work #241

Closed
leo60228 opened this issue Jan 4, 2019 · 4 comments
Closed

webio_serve and @app doesn't work #241

leo60228 opened this issue Jan 4, 2019 · 4 comments

Comments

@leo60228
Copy link

leo60228 commented Jan 4, 2019

Any request made using webio_serve and @app times out. The same code with Mux.stack works.

@stefan911
Copy link

I can't get any routing other than to "/" to work:

app = Mux.stack(page("/failhttp", req -> respond("fail")),
page("/", req -> itworks()),
page("/failws", req -> nope()))
WebIO.webio_serve(app, 8088)

appending /webio-socket to routes vs not appending seems to be the issue:
/webio-socket vs /failws/webio-socketin my case

@stefan911
Copy link

stefan911 commented Jan 7, 2019

Digging deeper :src/providers/mux.jl is appending the "webio-socket" string removing this from the websocket routing allows routing to work.

websock = Mux.App(Mux.mux(
Mux.wdefaults,
Mux.route("/", create_socket), #"/webio-socket" only seems to work at root
Mux.wclose,
Mux.notfound(),
))

This leads to a socket left open when leaving the page, forcing a close in the exception covers up the error rather than fixing it:

Mux/src/websockets_integration.jl
function wcatch(app, req)
try
app(req)
catch e
println(stderr, "Error handling websocket connection:")
showerror(stderr, e, catch_backtrace())
close(req[:socket]) #236 added to "recover" from exception.
end
end

@cstjean
Copy link
Contributor

cstjean commented Jan 7, 2020

@stefan911 Make a PR! It would be great to have a fix for this issue.

@shashi shashi closed this as completed Jan 8, 2020
@shashi
Copy link
Member

shashi commented Jan 8, 2020

Thanks @cstjean for #379

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

4 participants