SimonDanisch/Bonito.jl

Error in `ensure_connection(...)`

Opened this issue · 1 comments

When we try a websocket write, ensure_connection(...) is called, which calls setup_connection() without an argument

setup_connection();

However it looks like the config argument is actually required

const { session_id, proxy_url } = config;

Okay I managed to trigger this like so:

using HTTP
using Bonito: App
using Bonito.DOM
using Makie
#using WGLMakie


function main()
    # start a blocking server
    HTTP.listen() do http::HTTP.Stream
        HTTP.setstatus(http, 200)
        HTTP.startwrite(http)
        if http.message.target == "/fragment"
            app = App() do
                DOM.div("hi!")
            end
            io = IOBuffer()
            show(io, "text/html", app)
            body = take!(io)
            write(http, body)
        else
            write(http, "<html><body>")
            write(http, "<script src=\"https://unpkg.com/htmx.org@2.0.2\"></script>")
            write(http, "<h1>fragment insertion</h1>")
            write(http, "<button hx-get=\"/fragment\" hx-target=\"#results\">Click Me</button>")
            write(http, "<div id=\"results\"></div>")
            write(http, "</body></html>")
        end
    end
end

if abspath(PROGRAM_FILE) == @__FILE__
    main()
end

Related: MakieOrg/Makie.jl#4343 (comment)